Пример #1
0
    private void Awake()
    {
        if (instance != null)
        {
            Debug.LogWarning("Multiple instances of " + this + "found");
        }

        instance = this;
    }
Пример #2
0
    bool gameRunning;                // is the game running, or in the menu

    void Start()
    {
        audioManager  = AudioManager.instance;
        bulletManager = BulletManager.instance;
        duckManager   = DuckManager.instance;
        juiceManager  = JuiceManager.instance;
        timeManager   = TimeManager.instance;   // sets up singletons

        announcer = Announcer.instance;
        shooter   = Shooter.instance;
        dog       = Dog.instance;

        LoadMenu(); // loads the main menu
    }
Пример #3
0
    public void HitByPlayer(int projectilePlayerNumber, bool canHurtSelf = false)
    {
        if (GameManager.instance.SelectedGamemode != null)
        {
            if (GameManager.instance.SelectedGamemode.noFriendlyFire)
            {
                return;
            }
        }
        if (hasShield)
        {
            UseShield();
            return;
        }

        if (canHurtSelf == false)
        {
            if (projectilePlayerNumber == playerNumber)
            {
                return;
            }
        }
        if (isAlive == false)  // Already dead so cant be killed again
        {
            return;
        }
        isAlive = false;
        health  = 0;

        if (projectilePlayerNumber == playerNumber)
        {
            if (GameManager.instance.SelectedGamemode != null)
            {
                GameManager.instance.SelectedGamemode.AddToStats(playerNumber, StatTypes.Suicides, 1);
            }
        }

        if (isGamepad)
        {
            StartCoroutine("Haptic");
        }

        StartCoroutine("FlashHurt");
        JuiceManager.TimeSleep(playerParams.playerHitSlowMoDuration, playerParams.playerHitTimeScale, false);

        ParticleSystem p = Instantiate(bloodSplatterParticle, transform.position, Quaternion.identity);

        p.Play();
        Destroy(p.gameObject, 3);

        if (projectilePlayerNumber != playerNumber)
        {
            if (GameManager.instance.SelectedGamemode != null)
            {
                GameManager.instance.AwardKill(projectilePlayerNumber);
                ScorePopup scorePopup = Instantiate(LevelManager.instance.scorePopupPrefab, transform.position, Quaternion.identity);
                scorePopup.Init(GameManager.instance.SelectedGamemode.playerKillsPointReward);
            }
        }
        Death();
    }