Beispiel #1
0
    private void ProcessRaycast()
    {
        RaycastHit hit;

        if (Physics.Raycast(FPSCamera.transform.position, FPSCamera.transform.forward, out hit, weaponRange))
        {
            Headshot headshot = hit.transform.GetComponent <Headshot>();
            Enemy    enemy    = hit.transform.GetComponentInParent <Enemy>();
            if (headshot)
            {
                int headShotMultiplier = headshot.GetHeadshotMultiplier();
                if (playerUIHandler != null)
                {
                    playerUIHandler.AddToScore(enemy.GetValue() * headShotMultiplier);
                }
                ProcessEnemyHit(enemy, hit, weaponDamage * headShotMultiplier);
            }
            else if (enemy)
            {
                ProcessEnemyHit(enemy, hit, weaponDamage);
                if (playerUIHandler != null)
                {
                    playerUIHandler.AddToScore(enemy.GetValue());
                }
            }
            else
            {
                PlayDefaultHitEffect(hit.point);
            }
        }
    }
 public Player()
 {
     Name              = new PlayerName();
     ByeWeeks          = new ByeWeeks();
     Headshot          = new Headshot();
     EligiblePositions = new List <EligiblePosition>();
 }
        public void Apply(Hero hero, EntitiesManager manager)
        {
            var headshot    = new Headshot();
            var verbalAbuse = manager.SkillManager.Find("Verbal Abuse");

            hero.UnlearnSkill(verbalAbuse);
            hero.LearnSkillEvenly(headshot, 2);
            manager.SkillManager.Stored.Add(headshot);
        }
Beispiel #4
0
    protected virtual void OnPlayerHeadshot(Collision hitPlayer)
    {
        GameObject hit      = hitPlayer.gameObject;
        PhotonView hitView  = hit.GetPhotonView();
        Headshot   headShot = hit.GetComponent <Headshot>();

        //print("Player hit!");
        //// Only deal damage on shooter client
        if (PhotonNetwork.isMasterClient)
        {
            headShot.OnHeadshot(_damage * 2);
        }
        Destroy(gameObject);
    }