public AttackTarget(AIName name, int castle_level, int formation, int cost = 100)
 {
     Name      = name;
     Level     = castle_level;
     Formation = formation;
     Cost      = cost;
 }
Exemple #2
0
        public Enemy(string name, Vector2 position, AIName aiName, GameDevice gameDevice, IGameObjectMediator mediator)
            : base(name, position, 64, 64, 55, 60, gameDevice)
        {
            this.Position = position;
            this.aiName   = aiName;
            this.mediator = mediator;
            map           = mediator.GetMap();

            damageTimer     = new CountDownTimer(0.5f);
            gravity         = 0.5f;
            damageVelocityY = -5;

            state = CharaState.Normal;

            SetAI();

            //【追加】モーションの生成・追加
            motionDict = new Dictionary <MotionName, Util.Motion>()
            {
                { MotionName.attack, new Motion(new Range(0, 4), new CountDownTimer(0.25f)) },
                { MotionName.move, new Motion(new Range(0, 4), new CountDownTimer(0.15f)) },
                { MotionName.idling, new Motion(new Range(0, 4), new CountDownTimer(0.25f)) },
            };

            for (int i = 0; i <= 4; i++)
            {
                motionDict[MotionName.attack].Add(i, new Rectangle(new Point(64 * i, 0), new Point(64)));
            }
            for (int i = 0; i <= 4; i++)
            {
                motionDict[MotionName.move].Add(i, new Rectangle(new Point(64 * i, 0), new Point(64)));
            }
            for (int i = 0; i <= 4; i++)
            {
                motionDict[MotionName.idling].Add(i, new Rectangle(new Point(64 * i, 0), new Point(64)));
            }
            //最初のモーションはムーブに設定
            currentMotion = motionDict[MotionName.move];

            //【追加】移動方向の設定
            myDirectionX = Direction.Right;
            myDirectionY = Direction.Top;
        }
 public void AddTarget(AIName name, int castle_level, int formation, int army_cost = 100)
 {
     targets.Add(new AttackTarget(name, castle_level, formation, army_cost));
 }