Ejemplo n.º 1
0
    //PlayerScore score;

    // Called when script awake in editor
    void Awake()
    {
        playerAudio     = GetComponent <AudioSource>();
        playerShooting  = GetComponentInChildren <GunShooting>();
        capsuleCollider = GetComponent <CapsuleCollider>();
        fps             = GetComponent <FirstPersonController>();
        ikControl       = GetComponentInChildren <IKControl>();
        //score = GetComponent<PlayerScore>();
        healthSlider       = GameObject.FindGameObjectWithTag("Screen").GetComponentInChildren <Slider>();
        damageImage        = GameObject.FindGameObjectWithTag("Screen").transform.Find("DamageImage").GetComponent <Image>();
        currentHealth      = startingHealth;
        healthSlider.value = currentHealth;
    }
Ejemplo n.º 2
0
    private void SpawnSubsonic(Vector2 start, float angle, float speed, string team, string weapon, string shooter, GameObject gun, int bullets, bool network)
    {
        // Deals real damage and is the authorative version. The other spawned projectiles are just ghosts and unfortunately will often be innacurate due to latency.

        if (gun == null)
        {
            return;
        }

        GunShooting    shooting      = gun.GetComponent <GunShooting>();
        float          baseDamage    = shooting.Damage.Damage / (shooting.Damage.BulletsShareDamage ? bullets : 1f);
        float          falloffDamage = (shooting.Damage.Damage * shooting.Damage.DamageFalloff) / (shooting.Damage.BulletsShareDamage ? bullets : 1f);
        AnimationCurve curve         = shooting.Damage.DamageCurve;
        float          range         = shooting.Damage.Range;

        SubsonicBullet.Spawn(start, angle, speed, team, shooter, weapon, new Vector2(baseDamage, falloffDamage), curve, range);

        if (network)
        {
            // These are the only values that average clients need.
            RpcSpawnSubsonic(start, angle, speed, range);
        }
    }
Ejemplo n.º 3
0
 public void Start()
 {
     Anim     = GetComponent <Animator>();
     Shooting = GetComponentInParent <GunShooting>();
 }