Exemplo n.º 1
0
        private float GetAngle(PlayerEntity myEntity, PlayerEntity teamEntity)
        {
            //角度
            float yaw   = CommonMathUtil.TransComAngle(myEntity.orientation.Yaw);
            float angle = CommonMathUtil.GetAngle(new Vector2(teamEntity.position.Value.x, teamEntity.position.Value.z), new Vector2(myEntity.position.Value.x, myEntity.position.Value.z));

            return(CommonMathUtil.GetDiffAngle(angle, yaw));
        }
Exemplo n.º 2
0
        public bool Meet(IEventArgs args)
        {
            FreeData fd  = (FreeData)args.GetUnit(player);
            object   obj = ((FreeRuleEventArgs)args).GetEntity(entity);

            if (fd != null && obj != null)
            {
                PlayerEntity   playerEntity = fd.Player;
                FreeMoveEntity objEntity    = (FreeMoveEntity)obj;
                float          yaw          = CommonMathUtil.TransComAngle(playerEntity.orientation.Yaw);
                float          ang          = CommonMathUtil.GetAngle(new Vector2(objEntity.position.Value.x, objEntity.position.Value.z), new Vector2(playerEntity.position.Value.x, playerEntity.position.Value.z));
                return(CommonMathUtil.GetDiffAngle(ang, yaw) <= FreeUtil.ReplaceFloat(angle, args) && Vector3.Distance(playerEntity.position.Value, objEntity.position.Value) <= FreeUtil.ReplaceFloat(distance, args));
            }
            return(false);
        }