示例#1
0
 public void PlayStepSound()
 {
     if (CurrentStepSound == null)
     {
         return;
     }
     soundPlayer.ExecuteSound(CurrentStepSound, gameObject, "Player");
     soundPlayer.Play();
 }
示例#2
0
    public override void SetAction()
    {
        if (ActionFeed.Count == 0)
        {
            if (Dead)
            {
                CurrentAction = MirAction.Dead;
            }
            else
            {
                CurrentAction = MirAction.Standing;
            }
        }
        else
        {
            QueuedAction action = ActionFeed[0];
            ActionFeed.RemoveAt(0);

            CurrentAction            = action.Action;
            Direction                = action.Direction;
            Model.transform.rotation = ClientFunctions.GetRotation(Direction);
            BossHealupdate();
            switch (CurrentAction)
            {
            case MirAction.Walking:
            case MirAction.Running:
                int steps = 1;
                if (CurrentAction == MirAction.Running)
                {
                    steps = 2;
                }

                Vector3 targetpos = GameManager.CurrentScene.Cells[(int)action.Location.x, (int)action.Location.y].position;
                TargetPosition = targetpos;

                Vector2 back = ClientFunctions.Back(action.Location, Direction, steps);
                gameObject.transform.position = GameManager.CurrentScene.Cells[(int)back.x, (int)back.y].position;

                GameManager.CurrentScene.Cells[CurrentLocation.x, CurrentLocation.y].RemoveObject(this);
                GameManager.CurrentScene.Cells[action.Location.x, action.Location.y].AddObject(this);

                StartPosition  = gameObject.transform.position;
                TargetDistance = Vector3.Distance(transform.position, targetpos);
                IsMoving       = true;
                break;

            case MirAction.Attack:
                soundPlayer.ExecuteSound(AttackSound, gameObject, "Player");
                soundPlayer.Play();
                break;

            case MirAction.Struck:
                break;

            case MirAction.Die:
                soundPlayer.ExecuteSound(DeathSound, gameObject, "Player");
                soundPlayer.Play();
                Blocking = false;
                if (HealthBar != null)
                {
                    HealthBar.gameObject.SetActive(false);
                }
                CheckBossDead();
                Dead = true;
                break;
            }

            CurrentLocation = action.Location;
        }

        GetComponentInChildren <Animator>().SetInteger("CurrentAction", (int)CurrentAction);
    }