溺水传送至安全位置初步

This commit is contained in:
UnKownOwO
2022-12-20 21:32:33 +08:00
parent 056ae5f8d8
commit a288892f26
9 changed files with 102 additions and 63 deletions

View File

@@ -81,7 +81,7 @@ func (p *Player) InitAll() {
p.GameObjectGuidMap = make(map[uint64]GameObject)
p.CoopApplyMap = make(map[uint32]int64)
p.StaminaInfo = new(StaminaInfo)
p.StaminaInfo.DrownBackPos = new(Vector)
p.StaminaInfo.ActiveAvatarPos = new(Vector)
p.VehicleInfo = new(VehicleInfo)
p.VehicleInfo.LastCreateEntityIdMap = make(map[uint32]uint32)
p.InitAllAvatar()

View File

@@ -14,8 +14,8 @@ type StaminaInfo struct {
LastSkillId uint32 // 最后释放的技能Id
LastSkillTime int64 // 最后释放技能的时间
LastSkillStartTime int64 // 最后执行开始技能耐力消耗的时间
DrownBackTime int64 // 溺水返回安全点的时间
DrownBackPos *Vector // 溺水返回的安全点坐标
DrownBackDelay int64 // 溺水返回安全点延时
ActiveAvatarPos *Vector // 当前角色位置
}
// SetStaminaCost 设置动作需要消耗的耐力

View File

@@ -1,7 +1,14 @@
package model
import "math"
type Vector struct {
X float64 `bson:"x"`
Y float64 `bson:"y"`
Z float64 `bson:"z"`
}
// Distance 两坐标之间的距离
func (v *Vector) Distance(vector *Vector) float64 {
return math.Sqrt(math.Pow(v.X-vector.X, 2) + math.Pow(v.Y-vector.Y, 2) + math.Pow(v.Z-vector.Z, 2))
}