Beispiel #1
0
 public OrbitAIComponentData(XElement e) : base(e)
 {
     phiSpeed         = e.GetFloat("phi_speed");
     thetaSpeed       = e.GetFloat("theta_speed");
     radius           = e.GetFloat("radius");
     battleMovingType = (AttackMovingType)Enum.Parse(typeof(AttackMovingType), e.GetString("attack_moving_type"));
 }
        public WanderAIComponentData(XElement e) : base(e)
        {
            Vector3 min = e.GetFloatArray("min").ToVector3();
            Vector3 max = e.GetFloatArray("max").ToVector3();

            corners          = new MinMax(min, max);
            battleMovingType = (AttackMovingType)Enum.Parse(typeof(AttackMovingType), e.GetString("attack_moving_type"));
        }
Beispiel #3
0
 public PatrolAIComponentData(bool inAlignWithForwardDirection, float inRotationSpeed, Vector3 firstPoint, Vector3 secondPoint, AttackMovingType battleMovingType,
                              bool useHitProbForAgro)
     : base(inAlignWithForwardDirection, inRotationSpeed, useHitProbForAgro)
 {
     this.firstPoint       = firstPoint;
     this.secondPoint      = secondPoint;
     this.battleMovingType = battleMovingType;
 }
Beispiel #4
0
 public OrbitAIComponentData(bool inAlignWithForwardDirection, float inRotationSpeed, float phiSpeed, float thetaSpeed, float radius, AttackMovingType battleMovingType,
                             bool useHitProbForAgro = false)
     : base(inAlignWithForwardDirection, inRotationSpeed, useHitProbForAgro)
 {
     this.phiSpeed         = phiSpeed;
     this.thetaSpeed       = thetaSpeed;
     this.radius           = radius;
     this.battleMovingType = battleMovingType;
 }
 public StayAIComponentData(Hashtable hash)
     : base(hash)
 {
     battleMovingType = (AttackMovingType)hash.GetValue <int>((int)SPC.AttackMovingType, (int)AttackMovingType.AttackStay);
 }
 public StayAIComponentData(bool inAlignWithForwardDirection, float inRotationSpeed, AttackMovingType battleMovingType, bool useHitProbForAgro = false)
     : base(inAlignWithForwardDirection, inRotationSpeed, useHitProbForAgro)
 {
     this.battleMovingType = battleMovingType;
 }
 public StayAIComponentData(XElement e) : base(e)
 {
     battleMovingType = (AttackMovingType)Enum.Parse(typeof(AttackMovingType), e.GetString("attack_moving_type"));
 }
 public WanderAIComponentData(bool inAlignWithForwardDirection, float inRotationSpeed, MinMax corners, AttackMovingType battleMovingType, bool useHitProbForAgro = false)
     : base(inAlignWithForwardDirection, inRotationSpeed, useHitProbForAgro)
 {
     this.corners          = corners;
     this.battleMovingType = battleMovingType;
 }
Beispiel #9
0
 public FreeFlyNearPointComponentData(Hashtable hash) : base(hash)
 {
     radius           = hash.GetValue <float>((int)SPC.Radius, 0f);
     battleMovingType = (AttackMovingType)hash.GetValue <int>((int)SPC.AttackMovingType, (int)AttackMovingType.AttackStay);
 }
Beispiel #10
0
 public FreeFlyNearPointComponentData(bool inAlignWithForwardDirection, float inRotationSpeed, float radius, AttackMovingType battleMovingType, bool useHitProbForAgro = false)
     : base(inAlignWithForwardDirection, inRotationSpeed, useHitProbForAgro)
 {
     this.radius           = radius;
     this.battleMovingType = battleMovingType;
 }
Beispiel #11
0
 public FreeFlyNearPointComponentData(XElement e) : base(e)
 {
     radius           = e.GetFloat("radius");
     battleMovingType = (AttackMovingType)Enum.Parse(typeof(AttackMovingType), e.GetString("attack_moving_type"));
 }
Beispiel #12
0
 public PatrolAIComponentData(XElement e) : base(e)
 {
     firstPoint       = e.GetFloatArray("first_point").ToVector3();
     secondPoint      = e.GetFloatArray("second_point").ToVector3();
     battleMovingType = (AttackMovingType)Enum.Parse(typeof(AttackMovingType), e.GetString("attack_moving_type"));
 }
Beispiel #13
0
 public FollowPathCombatAIComponentData(bool inAlignWithForwardDirection, float inRotationSpeed, Vector3[] path, AttackMovingType battleMovingType, bool useHitProbForAgro = false)
     : base(inAlignWithForwardDirection, inRotationSpeed, useHitProbForAgro)
 {
     this.path             = path;
     this.battleMovingType = battleMovingType;
 }
Beispiel #14
0
 public FollowPathCombatAIComponentData(XElement e) : base(e)
 {
     path             = e.ToVector3List("path").ToArray();
     battleMovingType = (AttackMovingType)Enum.Parse(typeof(AttackMovingType), e.GetString("attack_moving_type"));
 }
Beispiel #15
0
        private static AIType LoadAIType(XElement element)
        {
            MovingType movingType = (MovingType)Enum.Parse(typeof(MovingType), element.GetString("name"));

            AttackMovingType attackMovingType = AttackMovingType.AttackIdle;

            if (element.HasAttribute("attack_moving_type"))
            {
                attackMovingType = (AttackMovingType)Enum.Parse(typeof(AttackMovingType), element.GetString("attack_moving_type"));
            }
            //bool chase = element.GetBool("chase");
            switch (movingType)
            {
            case MovingType.FreeFlyAtBox:
            {
                Vector3 min = element.GetFloatArray("min").ToVector3();
                Vector3 max = element.GetFloatArray("max").ToVector3();

                return(new FreeFlyAtBoxAIType {
                        corners = new MinMax {
                            min = min, max = max
                        },
                        battleMovingType = attackMovingType
                    });
            }

            case MovingType.FreeFlyNearPoint:
            {
                float radius = element.GetFloat("radius");
                return(new FreeFlyNearPointAIType {
                        battleMovingType = attackMovingType, radius = radius
                    });
            }

            case MovingType.OrbitAroundPoint:
            {
                float phiSpeed   = element.GetFloat("phi_speed");
                float thetaSpeed = element.GetFloat("theta_speed");
                float radius     = element.GetFloat("radius");
                return(new OrbitAroundPointAIType {
                        battleMovingType = attackMovingType, phiSpeed = phiSpeed, thetaSpeed = thetaSpeed, radius = radius
                    });
            }

            case MovingType.Patrol:
            {
                Vector3 first  = element.GetFloatArray("first").ToVector3();
                Vector3 second = element.GetFloatArray("second").ToVector3();
                return(new PatrolAIType {
                        battleMovingType = attackMovingType, firstPoint = first, secondPoint = second
                    });
            }

            case MovingType.None:
            {
                return(new NoneAIType {
                        battleMovingType = attackMovingType
                    });
            }

            case MovingType.FollowPathCombat:
            {
                Vector3[] path = element.ToVector3List("path").ToArray();
                return(new FollowPathAIType {
                        battleMovingType = attackMovingType, path = path
                    });
            }

            case MovingType.FollowPathNonCombat:
            {
                Vector3[] path = element.ToVector3List("path").ToArray();
                return(new FollowPathNonCombatAIType {
                        path = path
                    });
            }
            break;

            default:
                throw new Exception("undefined ai type: " + movingType);
            }
        }