Пример #1
0
    private void Update()
    {
        // Manage combat example
        CombatManager combatManager = combatManagerGameObject.GetComponent<CombatManager>();
        if (0 == counter)
            combatManager.StartCombat();
        if (1 == counter)
        {
            Debug.Log("Speed before: " + combatManager.activeCharacter.Speed);
            bool result = combatManager.ActiveCharacterMoves(3);
            Debug.Log("Speed after: " + combatManager.activeCharacter.Speed);
            if (result)
            {
                // move character in-game
            }
        }
        if (2 == counter)
            combatManager.EndActiveCharacterTurn();
        if (3 == counter)
            combatManager.EndActiveCharacterTurn();
        if (4 == counter)
        {
            Debug.Log("Speed before: " + combatManager.activeCharacter.Speed);
            bool result = combatManager.ActiveCharacterMoves(30);
            Debug.Log("Speed after: " + combatManager.activeCharacter.Speed);
            if (result)
            {
                // move character in-game
            }
        }
        if (5 == counter)
            combatManager.EndActiveCharacterTurn();
        if (6 == counter)
            combatManager.EndActiveCharacterTurn();
        if (7 == counter)
        {
            // Let's say active character is equipped with a dagger and wants to attack himself(easier to show with this code)
            // Normally the target character is to be acquired through the gui

            // combatManager.ActiveCharacterAttacks((Weapon)dagger, combatManager.activeCharacter);

            // The above peice of code cannot run as many things must be initialised in other parts of the game
        }
        counter++;
    }