Ejemplo n.º 1
0
    public void Shoot(Vector3 GunPoint, Quaternion PointerRotation)
    {
        if (CanShoot && AS.CheckCanShootPrimary())
        {
            SPS.PlayBoomerang();
            AS.ConsumePrimaryAmmoNoReload();
            GameObject TmpBullet = OPProjectile.FetchObject();             //= Instantiate (projectile, GunPoint, PointerRotation) as GameObject;
            TmpBullet.transform.rotation = PointerRotation;
            TmpBullet.transform.position = GunPoint;
            TmpBullet.SetActive(true);
            TmpBullet.GetComponent <ProjectileScript>().setPlayerReturn(transform);
            Component[] TrailArray;
            TrailArray = TmpBullet.GetComponentsInChildren <TrailRenderer> ();
            foreach (TrailRenderer Current in TrailArray)
            {
                Material TColor = Current.material;
                TColor.SetColor("_Color", ES.GetColor(PCS.GetPlayerNum()));
            }


            TmpBullet.layer = 17 + PCS.GetPlayerNum();
            TmpBullet.GetComponentInChildren <HitScript>().SetOwner(PCS.GetPlayerNum());
            TmpBullet.GetComponentInChildren <HitScript>().SetBulletNumber(BulletNumber);
            BulletNumber++;
            Color CtoChange = ES.GetColor(PCS.GetPlayerNum());
            CtoChange.r += .2f;
            CtoChange.g += .2f;
            CtoChange.b += .2f;
            TmpBullet.GetComponentInChildren <SpriteRenderer>().color = CtoChange;

            CanShoot  = false;
            ShotTimer = 0;
        }
    }