Beispiel #1
0
    void Start()
    {
        virusCB = SpawnCharacters(true);
        enemyCB = SpawnCharacters(false);

        SetActiveCharacter(virusCB);
        state = States.Player;
    }
Beispiel #2
0
 private void SetActiveCharacter(CharactersBattle charactersBattle)
 {
     if (activeCharacter != null)
     {
         activeCharacter.HideActive();
     }
     activeCharacter = charactersBattle;
     activeCharacter.ShowActive();
 }
    public void Attack(CharactersBattle runTarget, Action attackCompleted)
    {
        Vector3 runTargetPosition = (runTarget.GetPosition() - GetPosition()).normalized;
        Vector3 startingPosition  = GetPosition();

        runToPosition(runTargetPosition, () => {
            Vector3 attackDir = (runTarget.GetPosition() - GetPosition()).normalized;
            runToPosition(startingPosition, () => {
                state = States.Player;
            });
            attackCompleted();
        });
    }
Beispiel #4
0
    private CharactersBattle SpawnCharacters(bool isVirus)
    {
        Vector3 position;

        if (isVirus)
        {
            position = new Vector3(-50, -5);
        }
        else
        {
            position = new Vector3(50, -5);
        }

        Transform        characterTransform = Instantiate(pfCharacterBattle, position, Quaternion.identity);
        CharactersBattle charactersBattle   = characterTransform.GetComponent <CharactersBattle>();

        charactersBattle.Setup(isVirus);

        return(charactersBattle);
    }