コード例 #1
0
ファイル: BoardCell.cs プロジェクト: miskosz/BacteriaBattle
    // convert bacteria
    public void Convert()
    {
        state = state.Opponent();
        animator.SetInteger("Player", playerAnimId[(int)state]);
        PlayAnimation("Convert");
        GlobalAnimationTimer.AnimationTriggered(convertAnimationClip);

        // play audio
        MusicManagerSingleton.Instance.playSound(popAudio, audio);
    }
コード例 #2
0
ファイル: BoardCell.cs プロジェクト: miskosz/BacteriaBattle
    public void Spawn(BoardCellState _state)
    {
        if (state != _state)
        {
            state = _state;
            animator.SetInteger("Player", playerAnimId[(int)state]);
            PlayAnimation("Spawn");
            GlobalAnimationTimer.AnimationTriggered(spawnAnimationClip);

            // play audio
            MusicManagerSingleton.Instance.playSound(spawnAudio, audio);
        }
    }
コード例 #3
0
ファイル: BoardCell.cs プロジェクト: miskosz/BacteriaBattle
    // trigger splitting animation
    public void Split(BoardCell dest)
    {
        // rotate cell
        Vector3 direction = dest.transform.position - transform.position;

        // mirrored spritesheet hack
        if (state == BoardCellState.Player2)
        {
            direction *= -1;
        }
        Quaternion rotation = Quaternion.FromToRotation(Vector3.right, direction);


        cellAnim.transform.rotation      = rotation;
        dest.cellAnim.transform.rotation = rotation;

        PlayAnimation("Split");
        GlobalAnimationTimer.AnimationTriggered(splitAnimationClip);

        // play audio
        MusicManagerSingleton.Instance.playSound(divisionAudio, audio);
    }
コード例 #4
0
    IEnumerator AnimateActions(List <Action> actions)
    {
        // Process the actions by type, in the order split - convert - spawn.
        // Doing foreach 3x does not kill us.

        // split
        foreach (Action action in actions)
        {
            if (action.type == ActionType.Split)
            {
                boardCells[action.splitCell.i, action.splitCell.j].Split(boardCells[action.cell.i, action.cell.j]);
                yield return(StartCoroutine(GlobalAnimationTimer.WaitForAnimationEnd()));

                boardCells[action.cell.i, action.cell.j].Appear(board.playerOnTurn.Opponent());                // playerOnTurn already switched
            }
        }

        // convert
        foreach (Action action in actions)
        {
            if (action.type == ActionType.Convert)
            {
                boardCells[action.cell.i, action.cell.j].Convert();
            }
        }
        yield return(StartCoroutine(GlobalAnimationTimer.WaitForAnimationEnd()));

        // spawn
        foreach (Action action in actions)
        {
            if (action.type == ActionType.Spawn)
            {
                boardCells[action.cell.i, action.cell.j].Spawn(board.playerOnTurn.Opponent());                // playerOnTurn already switched
            }
        }
        yield return(StartCoroutine(GlobalAnimationTimer.WaitForAnimationEnd()));
    }