Esempio n. 1
0
    protected override void HitPlayer(Collision other)
    {
        PlayersGameplay playerScript = null;

        if (other.gameObject.tag == "Player")
        {
            playerScript = other.gameObject.GetComponent <PlayersGameplay> ();
        }

        if (tag == "Movable" && other.gameObject.tag == "Player" ||
            tag == "ThrownMovable" && other.gameObject.tag == "Player" && !trackingPlayer)
        {
            if (playerThatThrew == null || playerThatThrew != other.gameObject)
            {
                if (!trackingPlayer && playerThatThrew != null)
                {
                    StatsManager.Instance.PlayersHits(playerThatThrew, other.gameObject);
                }

                BombManager manager = (BombManager)GlobalVariables.Instance.lastManManager;

                if (manager.timer < 1 && !trackingPlayer && playerThatThrew != null)
                {
                    SteamAchievements.Instance.UnlockAchievement(AchievementID.ACH_BOMB);
                }

                playerScript.OnHoldMovable(gameObject, true);
                playerHolding = other.gameObject;

                mainCamera.GetComponent <ScreenShakeCamera>().CameraShaking(FeedbackType.Stun);
                mainCamera.GetComponent <ZoomCamera>().Zoom(FeedbackType.Stun);

                InstantiateParticles(other.contacts [0], GlobalVariables.Instance.HitParticles, GlobalVariables.Instance.playersColors [(int)playerScript.playerName]);
            }
        }

        if (tag == "DeadCube" && other.gameObject.tag == "Player" && trackingPlayer && playerScript.playerState != PlayerState.Dead)
        {
            hold          = true;
            playerHolding = other.gameObject;

            playerScript.OnDeath -= PlayerSuicide;
            playerScript.Death(DeathFX.All, other.contacts [0].point);

            mainCamera.GetComponent <ScreenShakeCamera>().CameraShaking(FeedbackType.Stun);
            mainCamera.GetComponent <ZoomCamera>().Zoom(FeedbackType.Stun);

            InstantiateParticles(other.contacts [0], GlobalVariables.Instance.HitParticles, GlobalVariables.Instance.playersColors [(int)playerScript.playerName]);
        }
    }
 public virtual void GetMovable(Collider other)
 {
     playerScript.OnHoldMovable(other.gameObject);
 }