Ejemplo n.º 1
0
        public override void Initialize(Stage stage)
        {
            base.Initialize(stage);

            if (stage.Parm.HasParm("AIRangedSpeedScalar"))
                speed *= stage.Parm.GetFloat("AIRangedSpeedScalar");

            missileOffset = Vector2.Zero;

            if(actor.Parm.HasParm("MissileOffset"))
                missileOffset = actor.Parm.GetVector2("MissileOffset");

            timeForPogoSkip = .1f;
            percAnimForSplat = .45f;
            if (actor.Parm.HasParm("MaxJumps"))
                maxRocketJumps = actor.Parm.GetInt("MaxJumps");
            if (actor.Parm.HasParm("MinJumps"))
                minRocketJumps = actor.Parm.GetInt("MinJumps");
            if (actor.Parm.HasParm("MaxAttacks"))
                maxRocketAttacks = actor.Parm.GetInt("MaxAttacks");
            if (actor.Parm.HasParm("MinAttacks"))
                minRocketAttacks = actor.Parm.GetInt("MinAttacks");
            if (actor.Parm.HasParm("PogoStartTime"))
                pogoStartTime = actor.Parm.GetFloat("PogoStartTime");
            if (actor.Parm.HasParm("PogoSkipTime"))
                timeForPogoSkip = actor.Parm.GetFloat("PogoSkipTime");
            if (actor.Parm.HasParm("PercAnimForSplat"))
                percAnimForSplat = actor.Parm.GetFloat("PercAnimForSplat");

            jumpSpeed = 22;

            spawnerIndex = -1;

            GetNumJumps();

            if (actor.PhysicsObject.physicsType == PhysicsObject.PhysicsType.CylinderCharacter)
            {
                actor.PhysicsObject.CylinderCharController.HorizontalMotionConstraint.Speed = speed;
                actor.PhysicsObject.CollisionInformation.CollisionRules.Group = PhysicsQB.normalAIGroup;
            }

            shouldAttack = true;
            target = PlayerAgent.Player;
            state = AIState.Moving;
            type = EnemyType.Ranged;
            actor.RegisterUpdateFunction(Update);
            actor.RegisterDeathFunction(DieFX);

            enemyAnimationAgent = actor.GetAgent<RangedEnemyAnimationAgent>();
            FaceTargetSnappedToPlane();

            Vector3 zero = Vector3.Zero;
            _myMissile = stage.GetQB<ActorQB>().CreateActor("Missile", "Missile", ref zero, ref zero, stage);
            _myMissile.ShutDown();
        }