Ejemplo n.º 1
0
    void EnemyDoDamage(Turns input)
    {
        EnemyShipState  test  = input.attackerObject.GetComponent <EnemyShipState>();
        PlayerShipState test2 = input.targetObject.GetComponent <PlayerShipState>();

        test2.player.shipHealth = test2.player.shipHealth - test.cannon.weaponAttack;
        UI.printToCombatLog("The " + test.enemy.shipName + " dealt " + test.cannon.weaponAttack.ToString() + " damage to the " + test2.player.shipName + "!");
        if (test2.player.shipHealth <= 0)
        {
            Destroy(input.targetObject);
            player.Remove(input.targetObject);
            PlayerStatus.ShipHealthCurrent = 0;
            UI.printToCombatLog("The " + test.enemy.shipName + " has sunk the " + test2.player.shipName + "!");
            playerWon  = false;
            combatOver = true;
        }
    }
Ejemplo n.º 2
0
 // Use this for initialization
 void Start()
 {
     combatState     = (CombatState)combatManager.GetComponent("CombatState"); // to get a non-static reference to the ViewScript Object
     playerShipState = (PlayerShipState)combatState.player[0].GetComponent("PlayerShipState");
     enemyShipState  = (EnemyShipState)combatState.player[0].GetComponent("EnemyShipState");
 }