コード例 #1
0
        public static Enemy CreateBoss2(Vector2 position, Texture2D enemyTexture)
        {
            var enemySprite = new Sprite(enemyTexture, 150, 160);

            enemySprite.CreateAnimmtion("idle", (2, 1), (2, 1), (2, 1), (0, 2), (0, 2), (0, 2), (1, 2), (1, 2), (1, 2));
            enemySprite.PlayAnimation("idle");
            enemySprite.CreateAnimmtion("die", (0, 0), (1, 0), (2, 0), (0, 1), (0, 2));

            var enemyPhysics = new Physics();

            enemyPhysics.EntityBoundingBoxType = Physics.BoundingBoxType.AABB;
            enemyPhysics.EntityPhysicsType     = Physics.PhysicsType.KINEMATICS;
            enemyPhysics.EntityImpluseType     = Physics.ImpluseType.NORMAL;

            var enemy = new Enemy();

            enemy.AddComponent(enemySprite);
            enemy.AddComponent(enemyPhysics);
            enemy.transform.position = position;
            enemy.Name = "enemy";
            enemy.hp   = 2;

            return(enemy);
        }
コード例 #2
0
    protected override void DoAction()
    {
        if (Enemy != null)
        {
            if (Enemy.GetComponent <Character> ().HasBlock())
            {
                Item.PlaySound(Sounds.HitBlocked);
            }
            else
            {
                Item.PlaySound(Sounds.Hit);
            }

            if (Enemy != null)
            {
                DamageTaker dmg = Enemy.AddComponent <DamageTaker> ();
                dmg.HowMuch = Power;
            }
        }
        if (GetAnimator())
        {
            GetAnimator().SetTrigger("attack");
        }
    }
コード例 #3
0
 public MoveAndAttackBehaviour(Enemy owner, GameMap map) : base(owner)
 {
     owner.AddComponent(new MoveAction(map));
     owner.AddComponent(new AttackAction(map, 1, owner.Stats));
     _map = map;
 }