Exemplo n.º 1
0
    public static void EnemyAttack()
    {
        foreach (EnemyBehaviour enemy in instance.activeEnemies)
        {
            if (enemy.Active != false)
            {
                Transform target = CharacterObserver.GetEnemyTarget();
                if (target != null)
                {
                    PlayerMoveCommand move = new PlayerMoveCommand();
                    move.AssignMove(enemy.transform, enemy.transform.position, target.position);
                    PlayerCommand.AddCommand(move);

                    AttackCommand attack = new AttackCommand();
                    attack.AssignCommand(10, target.gameObject);
                    attack.AssignAnimation(enemy.gameObject, "Attack", 0f);
                    PlayerCommand.AddCommand(attack);

                    PlayerMoveCommand move2 = new PlayerMoveCommand();
                    move2.AssignMove(enemy.transform, target.position, enemy.transform.position);
                    PlayerCommand.AddCommand(move2);
                }
            }
        }
    }
Exemplo n.º 2
0
    public override void ActivateAction()
    {
        originPosition = Performer.transform.position;
        PlayerMoveCommand moveCommand = new PlayerMoveCommand();

        moveCommand.AssignMove(Performer, Performer.position, Target.position);
        PlayerCommand.AddCommand(moveCommand);

        AttackCommand attackCommand = new AttackCommand();

        attackCommand.AssignCommand(Damage, Target.gameObject);
        attackCommand.AssignAnimation(Performer.gameObject, animationTrigger, actionDuration);
        PlayerCommand.AddCommand(attackCommand);

        PlayerMoveCommand returnCommand = new PlayerMoveCommand();

        returnCommand.AssignMove(Performer, Target.position, originPosition);
        PlayerCommand.AddCommand(returnCommand);
    }