コード例 #1
0
    private void cannonballStrikesPlayer(Vector3 cannonballDirection)
    {
        //damage player,
        //make them invulnerable,
        //turn them red
        //begin knocking them back

        if (isVulnerable)
        {
            isVulnerable = false;
            invulnerabilityDuration_current = invulnerabilityDuration_max;

            playDamagePlayerShipAnimation(cannonballDirection);

            // playerBoat_actual.GetComponent<Renderer>().material.SetColor("_Color", new Color32(180, 180, 180, 255));
            playerBoat_actual_renderer_main.material.SetColor("_Color", new Color32(180, 180, 180, 255));
            playerBoat_actual_renderer_sail.material.SetColor("_Color", new Color32(180, 180, 180, 255));

            // TODO: Damage health, sink ship...
            shipHealth_current--;
            if (shipHealth_current == 0)
            {
                playerShipSinks_part1();
            }

            healthBarManager.playerHasBeenDamaged();


            // For now:
            // lostMoney(25000);
        }
    }