Example #1
0
 public void PullUpMenu(int PNum)
 {
     if (MenuActive == false && Time.timeScale == 1)
     {
         CurrentPlayer [PNum] = true;
         for (int i = 0; i < PCS.Length; i++)
         {
             if (PCS [i] != null)
             {
                 PCS [i].EnableControls(false);
             }
         }
         MenuActive     = true;
         Time.timeScale = 0;
         for (int i = 0; i <= 3; i++)
         {
             FullPauseMenu [i].SetColor(ES.GetColor(PNum) - new Color(.2f, .2f, .2f, 0f));
             FullPauseMenu [i].MakeActive();
         }
         for (int i = 4; i <= 11; i++)
         {
             FullPauseMenu [i].SetColor(ES.GetColor(PNum) + new Color(.3f, .3f, .3f, 0f));
             FullPauseMenu [i].MakeActive();
         }
         for (int i = 0; i < UIButton.Length; i++)
         {
             UIButton [i].SetBoarderColor(ES.GetColor(PNum) + new Color(.3f, .3f, .3f, 0f));
             UIButton [i].MakeActive();
             SetBoarderDeActive(0, i);
         }
         SetBoarderActive(PNum);
     }
 }
Example #2
0
    void FireBullet(Vector3 GunPoint, Quaternion PointerRotation)
    {
        GameObject TmpBullet = OPProjectile.FetchObject();         //= Instantiate (projectile, GunPoint, PointerRotation) as GameObject;

        TmpBullet.transform.rotation = PointerRotation;
        TmpBullet.transform.position = GunPoint;
        TmpBullet.SetActive(true);
        GameObject TmpTrail = OPTrail.FetchObject();         //Instantiate (Trail, GunPoint, PointerRotation) as GameObject;

        TmpTrail.SetActive(true);
        TmpTrail.GetComponent <TrailFollowScript>().SetThingToFollow(TmpBullet.transform);
        Material TColor = TmpTrail.GetComponent <TrailRenderer>().material;

        TColor.SetColor("_Color", ES.GetColor(PCS.GetPlayerNum()));
        TmpBullet.layer = 17 + PCS.GetPlayerNum();
        TmpBullet.GetComponentInChildren <HitScript>().SetOwner(PCS.GetPlayerNum());
        TmpBullet.GetComponentInChildren <HitScript>().SetBulletNumber(BulletNumber);

        Color CtoChange = ES.GetColor(PCS.GetPlayerNum());

        CtoChange.r += .2f;
        CtoChange.g += .2f;
        CtoChange.b += .2f;
        TmpBullet.GetComponentInChildren <SpriteRenderer>().color = CtoChange;
    }
    public void Shoot(Vector3 GunPoint, Quaternion PointerRotation)
    {
        if (CanShoot && AS.CheckCanShootPrimary())
        {
            SPS.playShoot();
            AS.ConsumePrimaryAmmo();
            GameObject TmpBullet = OPProjectile.FetchObject();             //= Instantiate (projectile, GunPoint, PointerRotation) as GameObject;
            TmpBullet.transform.rotation = PointerRotation;
            TmpBullet.transform.position = GunPoint;

            GameObject TmpTrail = OPTrail.FetchObject();             //Instantiate (Trail, GunPoint, PointerRotation) as GameObject;
            TmpTrail.SetActive(true);
            TmpBullet.SetActive(true);
            TmpTrail.GetComponent <TrailFollowScript>().SetThingToFollow(TmpBullet.transform);
            Material TColor = TmpTrail.GetComponent <TrailRenderer>().material;
            TColor.SetColor("_Color", ES.GetColor(PCS.GetPlayerNum()));
            TmpBullet.layer = 17 + PCS.GetPlayerNum();
            TmpBullet.GetComponentInChildren <HitScript>().SetOwner(PCS.GetPlayerNum());
            Color CtoChange = ES.GetColor(PCS.GetPlayerNum());
            CtoChange.r += .2f;
            CtoChange.g += .2f;
            CtoChange.b += .2f;
            TmpBullet.GetComponentInChildren <SpriteRenderer>().color = CtoChange;
            TmpBullet.GetComponentInChildren <HitScript>().SetOwner(PCS.GetPlayerNum());
            TmpBullet.GetComponentInChildren <HitScript>().SetBulletNumber(BulletNumber);
            TmpBullet.GetComponentInChildren <ExplosionScript>().SetBulletNumber(BulletNumber);
            BulletNumber++;
            TmpBullet.GetComponentInChildren <ExplosionScript>().SetOwner(PCS.GetPlayerNum());
            CanShoot  = false;
            ShotTimer = 0;
        }
    }
Example #4
0
    public void Detonate()
    {
        Quaternion PointerRotation = Quaternion.identity;

        SPS.playExplosion();

        for (int i = 0; i < 20; i++)
        {
            GameObject TmpBullet = OPProjectile.FetchObject();              //= Instantiate (projectile, transform.position, PointerRotation) as GameObject;
            TmpBullet.transform.rotation = PointerRotation;
            TmpBullet.transform.position = transform.position;

            GameObject TmpTrail = OPTrail.FetchObject();              //Instantiate (Trail, transform.position, PointerRotation) as GameObject;

            TmpTrail.GetComponent <TrailFollowScript> ().SetThingToFollow(TmpBullet.transform);
            Material TColor = TmpTrail.GetComponent <TrailRenderer> ().material;
            TColor.SetColor("_Color", ES.GetColor(PlayerNum));
            TmpBullet.layer = 17 + PlayerNum;

            Color CtoChange = ES.GetColor(PlayerNum);
            CtoChange.r    += .2f;
            CtoChange.g    += .2f;
            CtoChange.b    += .2f;
            PointerRotation = PointerRotation * Quaternion.Euler(0, 0, 18);

            //TmpBullet.GetComponent<ProjectileScript>().Speed = pSpeed;
            TmpBullet.SetActive(true);
            TmpTrail.SetActive(true);
            TmpBullet.GetComponentInChildren <HitScript> ().SetOwner(PlayerNum);

            TmpBullet.GetComponentInChildren <HitScript>().SetBulletNumber(BulletNumber);
            TmpBullet.GetComponentInChildren <SpriteRenderer> ().color = CtoChange;
        }
        gameObject.SetActive(false);
    }
Example #5
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;
        }
    }
Example #6
0
    // Use this for initialization
    void Start()
    {
        RS       = GameObject.Find("RespawnObject").GetComponent <RespawnScript>();
        Stats    = GameObject.Find("TotalStatsHolder").GetComponent <EndGameStatsScript>();
        ES       = GameObject.Find("EternalHolder").GetComponent <EternalScript> ();
        WinText  = GameObject.Find("WinTextObj").GetComponent <Text>();
        WarBarP1 = GameObject.Find("KillBarP1").GetComponent <Image> ();
        WarBarP2 = GameObject.Find("KillBarP2").GetComponent <Image> ();
        WarBarP3 = GameObject.Find("KillBarP3").GetComponent <Image> ();
        WarBarP4 = GameObject.Find("KillBarP4").GetComponent <Image> ();

        WarBarP1.color = ES.GetColor(0);
        WarBarP2.color = ES.GetColor(1);
        WarBarP3.color = ES.GetColor(2);
        WarBarP4.color = ES.GetColor(3);

        WarBarP1.fillAmount = 0;
        WarBarP2.fillAmount = 0;
        WarBarP3.fillAmount = 0;
        WarBarP4.fillAmount = 0;
        P1Kills             = 0;
        P2Kills             = 0;
        P3Kills             = 0;
        P4Kills             = 0;

        KillsToWin      = ES.GetKillNumber();
        WinText.text    = "";
        WinText.enabled = false;

        // temporary dev tool
        KillsToWin = 10;
    }
Example #7
0
    public void Shoot(Vector3 GunPoint, Quaternion PointerRotation)
    {
        if (CanShoot && AS.CheckCanShootPrimary())
        {
            SPS.PlayBoomerang();
            AS.ConsumePrimaryAmmo(false);
            GameObject TmpBullet = OPProjectile.FetchObject();
            TmpBullet.transform.position = GunPoint;
            TmpBullet.transform.rotation = PointerRotation;
            TmpBullet.SetActive(true);
            Material TColor = TmpBullet.GetComponentInChildren <TrailRenderer>().material;

            TmpBullet.layer = 17 + PCS.GetPlayerNum();
            TmpBullet.GetComponentInChildren <HitScript>().SetOwner(PCS.GetPlayerNum());
            TmpBullet.GetComponentInChildren <HitScript>().SetBulletNumber(BulletNumber);
            BulletNumber++;
            Color CtoChange = ES.GetColor(PCS.GetPlayerNum());

            Component[] sprites = TmpBullet.GetComponentsInChildren <SpriteRenderer>();
            foreach (SpriteRenderer s in sprites)
            {
                s.color      = CtoChange;
                CtoChange.r += .2f;
                CtoChange.g += .2f;
                CtoChange.b += .2f;
            }
            TColor.SetColor("_Color", CtoChange);
            CanShoot  = false;
            ShotTimer = 0;
        }
    }
    //SoundPlayerScript SPS;
    //bool CanStepSound;
    //int StepCounter;

    // Use this for initialization
    void Start()
    {
        //CanStepSound = true;
        //StepCounter = 0;
        //SPS = GameObject.Find ("Main Camera").GetComponent<SoundPlayerScript> ();
        PauseScript = GameObject.Find("PauseMenuComponent").GetComponent <UIPauseMenuScript>();
        ES          = GameObject.Find("EternalHolder").GetComponent <EternalScript> ();
        RB          = GetComponent <Rigidbody2D> ();
        LR          = GetComponent <LineRenderer> ();
        RS          = GameObject.Find("RespawnObject").GetComponent <RespawnScript>();
        PauseScript.SetPlayer(PlayerNumber, this);
        AimingCursor.SetActive(false);
        ReticleRB = AimingCursor.GetComponent <Rigidbody2D> ();
        AimingCursor.GetComponent <SpriteRenderer> ().color = GetComponent <SpriteRenderer> ().color;
        Color C = ES.GetColor(PlayerNumber);

        C.r += .2f;
        C.g += .2f;
        C.b += .2f;
        Color C2 = C;

        C2.a = .2f;
        LR.SetColors(C, C2);
        currentRot = Quaternion.identity;
        if (BounceReticle)
        {
            LR.SetVertexCount(4);
        }
    }
Example #9
0
    public void Shoot(Vector3 GunPoint, Quaternion PointerRotation)
    {
        if (CanShoot && AS.CheckCanShootSecondary())
        {
            int          Layer = 1 << 9;
            RaycastHit2D hit   = Physics2D.Raycast(transform.position, transform.up, Mathf.Infinity, Layer);
            if (hit.collider != null && (hit.collider.tag == "Wall" || hit.collider.tag == "MovingWall") && hit.distance < .5f)
            {
                SPS.playGrenadeToss();
                AS.ConsumeSecondaryAmmo();
                GameObject TmpBullet = OPProjectile.FetchObject();
                TmpBullet.transform.position = hit.point;
                Debug.Log(hit.normal);
                Debug.Log(Mathf.Atan2(hit.normal.x, hit.normal.y) * Mathf.Rad2Deg);
                TmpBullet.transform.rotation = Quaternion.identity;
                TmpBullet.transform.rotation = Quaternion.FromToRotation(TmpBullet.transform.up, hit.normal);

                TmpBullet.SetActive(true);
                TmpBullet.layer = 17 + PCS.GetPlayerNum();
                TmpBullet.GetComponentInChildren <HitScript>().SetOwner(PCS.GetPlayerNum());
                Color CtoChange = ES.GetColor(PCS.GetPlayerNum());
                TmpBullet.GetComponentInChildren <SpriteRenderer>().color = CtoChange;
                TmpBullet.GetComponent <TripMineLineScript>().SetColors(CtoChange);
                TmpBullet.GetComponentInChildren <ExplosionScript>().SetOwner(PCS.GetPlayerNum());
                CanShoot  = false;
                ShotTimer = 0;

                TmpBullet.transform.parent = hit.collider.transform;
            }
        }
    }
Example #10
0
    public void Shoot(Vector3 GunPoint, Quaternion PointerRotation)
    {
        if (CanShoot && AS.CheckCanShootPrimary())
        {
            Color CtoChange = ES.GetColor(PCS.GetPlayerNum());
            CtoChange.r += .025f;
            CtoChange.g += .025f;
            CtoChange.b += .025f;

            AS.ConsumePrimaryAmmo();
            GameObject TmpBullet = OPProjectile.FetchObject();

            TmpBullet.GetComponent <LazerProjectileScript>().ShootLine(chargeLevel, CtoChange, transform.position, transform.up, PCS.GetPlayerNum(), BulletNumber);


            //if (chargeLevel > 2){
            //		diff = new Vector2( hit2.point.x - hit.point.x, hit2.point.y - hit.point.y);
            //			hit3 = Physics2D.Raycast (hit2.point, Vector3.Reflect(diff.normalized, hit2.normal), Mathf.Infinity, Layer);
            //				TmpBullet.GetComponent<LazerProjectileScript>().ShootLine(chargeLevel, CtoChange, transform.position, hit.point, hit2.point, hit3.point);
//				}else{
//					TmpBullet.GetComponent<LazerProjectileScript>().ShootLine(chargeLevel, CtoChange, transform.position, hit.point, hit2.point);
//				}


            //TmpBullet.SetActive(true);
            //TmpBullet.layer = 17 + PCS.GetPlayerNum();
            //TmpBullet.GetComponent<HitScript>().BulletDamage = chargeLevel;
            //TmpBullet.GetComponent<HitScript>().SetBulletNumber(BulletNumber);
            BulletNumber++;
            //TmpBullet.GetComponent<HitScript>().SetOwner(PCS.GetPlayerNum());

            TmpBullet.GetComponentInChildren <LineRenderer>().SetColors(CtoChange, CtoChange);

            SPS.PlayLazerShoot();
            CanShoot     = false;
            ShotTimer    = 0;
            chargeLevel  = 1;
            chargeAmount = 0;

            particlesSystem.startColor = ES.GetColor(PCS.GetPlayerNum());

            particlesOBJ.transform.localScale = new Vector2(1f, 1f);
            particlesSystem.emissionRate      = 25f;
            particlesOBJ.SetActive(false);
            firstPress = true;
        }
    }
Example #11
0
    // checks health numbers for death
    void HealthCheck(int PlayerNum)
    {
        if (health <= 0)
        {
            DeathTrans.position = transform.position;
            DeathPaticles.Emit(25);
            SPS.playDeath();

            Stats.IncrementDeaths(PCS.GetPlayerNum());
            CCS.CancelDeathAnimations();
            if (PlayerNum != PCS.GetPlayerNum())
            {
                if (RHS.UpdateScore(PlayerNum))
                {
                    CCS.PlayDeathAnimations(transform.position, ES.GetColor(PlayerNum), true);
                }
                else
                {
                    CCS.PlayDeathAnimations(transform.position, ES.GetColor(PlayerNum));
                }
            }
            else
            {
                RHS.UpdateScore(PlayerNum, true);
                Stats.IncrementSuicides(PlayerNum);
                CCS.PlayDeathAnimations(transform.position, ES.GetColor(PlayerNum));
            }
            Component[] DeathParticlesArray;
            CorpseObject.transform.position = transform.position;
            DeathParticlesArray             = CorpseObject.GetComponentsInChildren <DeathAnimationScript> ();
            foreach (DeathAnimationScript Current in DeathParticlesArray)
            {
                Current.PlayDeathAnim(PlayerColor);
            }

            Component[] arrows = GetComponentsInChildren <WallStickScript>();
            foreach (WallStickScript ws in arrows)
            {
                ws.transform.parent = null;
            }
            Destroy(gameObject);
        }
    }
Example #12
0
 void OnLevelWasLoaded(int level)
 {
     if (level == 2)
     {
         ES                = GameObject.Find("EternalHolder").GetComponent <EternalScript> ();
         CurrentColor      = ES.GetColor(PlayerNum);
         RedSlider.value   = CurrentColor.r;
         GreenSlider.value = CurrentColor.g;
         BlueSlider.value  = CurrentColor.b;
     }
 }
Example #13
0
    // Use this for initialization
    void Start()
    {
        SPS               = GameObject.Find("SoundObject").GetComponent <SoundPlayerScript> ();
        PCS               = GetComponent <PlayerControlScript> ();
        ES                = GameObject.Find("EternalHolder").GetComponent <EternalScript> ();
        SpriteColor       = GetComponent <SpriteRenderer> ();
        CurrentColor      = ES.GetColor(PCS.GetPlayerNum());
        SpriteColor.color = CurrentColor;

        Stats = GameObject.Find("TotalStatsHolder").GetComponent <EndGameStatsScript>();
    }
    public void Shoot(Vector3 GunPoint, Quaternion PointerRotation)
    {
        if (CanShoot && AS.CheckCanShootSecondary())
        {
            SPS.playGrenadeToss();
            AS.ConsumeSecondaryAmmo();
            GameObject tmp = Instantiate(projectile, GunPoint, PointerRotation) as GameObject;

            Material TColor = tmp.GetComponentInChildren <TrailRenderer>().material;
            TColor.SetColor("_Color", ES.GetColor(PCS.GetPlayerNum()));
            tmp.layer = 17 + PCS.GetPlayerNum();
            tmp.GetComponentInChildren <HitScript>().SetOwner(PCS.GetPlayerNum());
            Color CtoChange = ES.GetColor(PCS.GetPlayerNum());
            CtoChange.r += .2f;
            CtoChange.g += .2f;
            CtoChange.b += .2f;
            tmp.GetComponentInChildren <SpriteRenderer>().color = CtoChange;
            CanShoot  = false;
            ShotTimer = 0;
        }
    }
Example #15
0
    void WinAnimations(int WinPnum)
    {
        PMS.disablePlayerControls();
        Stats.ShowStats();
        //Invoke("RestartMatch", 10f);
        CanCheck = false;
        RS.DisableControls();

        GameObject tmp;

        tmp = Instantiate(RandomShooter, new Vector3(8, 4, 0), Quaternion.identity) as GameObject;
        tmp.GetComponent <ParticleSystem> ().startColor = ES.GetColor(WinPnum);
        tmp = Instantiate(RandomShooter, new Vector3(8, -4, 0), Quaternion.identity) as GameObject;
        tmp.GetComponent <ParticleSystem> ().startColor = ES.GetColor(WinPnum);
        tmp = Instantiate(RandomShooter, new Vector3(-8, 4, 0), Quaternion.identity) as GameObject;
        tmp.GetComponent <ParticleSystem> ().startColor = ES.GetColor(WinPnum);
        tmp = Instantiate(RandomShooter, new Vector3(-8, -4, 0), Quaternion.identity) as GameObject;
        tmp.GetComponent <ParticleSystem> ().startColor = ES.GetColor(WinPnum);
        tmp = Instantiate(RandomShooter, new Vector3(0, 4, 0), Quaternion.identity) as GameObject;
        tmp.GetComponent <ParticleSystem> ().startColor = ES.GetColor(WinPnum);
        tmp = Instantiate(RandomShooter, new Vector3(0, -4, 0), Quaternion.identity) as GameObject;
        tmp.GetComponent <ParticleSystem> ().startColor = ES.GetColor(WinPnum);
        for (int i = 0; i < 10; i++)
        {
            //WinBackgrounds[i].GetComponent<Image>().color = ES.GetColor(WinPnum);
            //WinBackgrounds[i].GetComponent<UIAnimationScript>().MakeActive();
        }
        //WinText.enabled = true;
    }
Example #16
0
 void releaseCharge()
 {
     if (CanShoot && AS.CheckCanShootPrimary())
     {
         // change to sword sound
         SPS.playShoot();
         AS.ConsumePrimaryAmmo();
         GameObject TmpBullet = Instantiate(projectile, GunPointPerm, RotationPerm) as GameObject;
         TmpBullet.transform.parent = transform;
         Material TColor = TmpBullet.GetComponentInChildren <TrailRenderer>().material;
         TColor.SetColor("_Color", ES.GetColor(PCS.GetPlayerNum()));
         TmpBullet.layer = 17 + PCS.GetPlayerNum();
         TmpBullet.GetComponentInChildren <HitScript>().SetOwner(PCS.GetPlayerNum());
         Color CtoChange = ES.GetColor(PCS.GetPlayerNum());
         CtoChange.r += .2f;
         CtoChange.g += .2f;
         CtoChange.b += .2f;
         TmpBullet.GetComponentInChildren <SpriteRenderer>().color = CtoChange;
         CanShoot     = false;
         ShotTimer    = 0;
         ChargeAmount = 0;
     }
 }
Example #17
0
 public void Shoot(Vector3 GunPoint, Quaternion PointerRotation)
 {
     if (CanShoot && AS.CheckCanShootSecondary())
     {
         SPS.playGrenadeToss();
         POutline.SetActive(false);
         GameObject TMP = OPWall.FetchObject();
         TMP.transform.position = GunPoint;
         TMP.transform.rotation = PointerRotation;
         TMP.GetComponent <SpriteRenderer>().color = ES.GetColor(PCS.GetPlayerNum());
         TMP.SetActive(true);
         AS.ConsumeSecondaryAmmo();
     }
 }
Example #18
0
    void StatsDelay()
    {
        InputEnabled = true;
        UIBars.transform.localPosition = new Vector2(0, -2000f);
        for (int x = 0; x < 4; x++)
        {
            Kfield[x].text          = kills[x].ToString();
            Dfield[x].text          = deaths[x].ToString();
            Sfield[x].text          = shotsFired[x].ToString();
            DamageDoneField[x].text = damageDone[x].ToString();
            SuicideField[x].text    = Suicides[x].ToString();

            float Percent;
            if (shotsFired[x] == 0)
            {
                Percent = 0;
            }
            else
            {
                Percent = (((float)shotsHit[x] / (float)shotsFired[x]) * 100f);
                if (Percent > 100)
                {
                    Percent = 100;
                }
                Percent = Mathf.Round(Percent);
            }
            Afield[x].text = Percent.ToString() + "%";

            Color Ctmp = Color.grey;
            if (ES.GetActivePlayer(x))
            {
                Ctmp = ES.GetColor(x);
                weaponText[x].text     = getWeapon(x);
                Ctmp.a                 = .75f;
                SR[x].color            = Ctmp;
                placementField[x].text = DeterminePlace(x);
                titleText[x].text      = GetRandomLine();
            }
            else
            {
                readyImage[x].color = Color.green;
                Ctmp.a      = .75f;
                SR[x].color = Ctmp;
                DeterminePlace(x);
                placementField[x].text = "Non Participant";
            }
        }
        Invoke("EndMatch", 30f);
    }
Example #19
0
    void OnDisable()
    {
        if (first)
        {
            first = false;
        }
        else
        {
            Quaternion PointerRotation = Quaternion.identity;
            SPS.playExplosion();
            for (int i = 0; i < 20; i++)
            {
                GameObject TmpBullet = OPProjectile.FetchObject();
                TmpBullet.transform.rotation = PointerRotation;
                TmpBullet.transform.position = transform.position;

                GameObject TmpTrail = OPTrail.FetchObject();

                TmpTrail.GetComponent <TrailFollowScript> ().SetThingToFollow(TmpBullet.transform);
                Material TColor = TmpTrail.GetComponent <TrailRenderer> ().material;
                TColor.SetColor("_Color", ES.GetColor(PlayerNum));
                TmpBullet.layer = 17 + PlayerNum;

                Color CtoChange = ES.GetColor(PlayerNum);
                CtoChange.r    += .2f;
                CtoChange.g    += .2f;
                CtoChange.b    += .2f;
                PointerRotation = PointerRotation * Quaternion.Euler(0, 0, 18);
                TmpBullet.SetActive(true);
                TmpTrail.SetActive(true);
                TmpBullet.GetComponentInChildren <HitScript> ().SetOwner(PlayerNum);
                TmpBullet.GetComponentInChildren <HitScript> ().SetBulletNumber(BulletNumber);
                TmpBullet.GetComponentInChildren <SpriteRenderer> ().color = CtoChange;
            }
        }
    }
Example #20
0
    // Use this for initialization
    void Start()
    {
        ES  = GameObject.Find("EternalHolder").GetComponent <EternalScript> ();
        SPS = GameObject.Find("SoundObject").GetComponent <SoundPlayerScript> ();
        PCS = GetComponent <PlayerControlScript> ();
        AS  = GetComponent <AmmoScript>();
        AS.SetSecondaryMagazineSize(2);
        PCS.SetSecondaryWeapon(ShootOutline);
        PCS.SetSecondaryWeaponRelease(Shoot);
        CanShoot   = true;
        projectile = Resources.Load("ShieldPrefab") as GameObject;
        POutline   = Instantiate(projectile, Vector3.zero, Quaternion.identity) as GameObject;
        Color CtoChange = ES.GetColor(PCS.GetPlayerNum());

        CtoChange.a = .75f;
        POutline.GetComponent <SpriteRenderer> ().color = CtoChange;
        POutline.SetActive(false);
    }
Example #21
0
 // Use this for initialization
 void Start()
 {
     ES           = GameObject.Find("EternalHolder").GetComponent <EternalScript> ();
     PCS          = GetComponent <PlayerControlScript> ();
     SPS          = GameObject.Find("SoundObject").GetComponent <SoundPlayerScript> ();
     OPProjectile = GameObject.Find("ObjectPoolerLazer").GetComponent <ObjectPoolScript> ();
     particlesOBJ = Resources.Load("ChargeParticleHolder") as GameObject;
     AS           = GetComponent <AmmoScript>();
     AS.SetPrimaryMagazineSize(6);
     AS.SetReloadTime(3f);
     PCS.SetPrimaryWeapon(Charge);
     PCS.SetPrimaryWeaponRelease(Shoot);
     ShotTimer                  = 0;
     chargeLevel                = 1;
     ShootFireCooldown          = 7;
     CanShoot                   = true;
     particlesOBJ               = Instantiate(particlesOBJ, transform.position, transform.rotation) as GameObject;
     particlesSystem            = particlesOBJ.GetComponentInChildren <ParticleSystem> ();
     particlesSystem.startColor = ES.GetColor(PCS.GetPlayerNum());
     particlesOBJ.SetActive(false);
 }
Example #22
0
    public void Shoot(Vector3 GunPoint, Quaternion PointerRotation)
    {
        if (CanShoot && numOfMines > 2)
        {
            for (int x = 0; x < numOfMines; x++)
            {
                mines[x].GetComponent <SachelExplosionScript>().Detonate();
            }
            numOfMines = 0;
        }
        else if (CanShoot && AS.CheckCanShootPrimary())
        {
            SPS.playGrenadeToss();
            AS.ConsumePrimaryAmmo();
            GameObject TmpBullet = OPProjectile.FetchObject();             //= Instantiate (projectile, GunPoint, PointerRotation) as GameObject;
            TmpBullet.transform.rotation = PointerRotation;
            TmpBullet.transform.position = GunPoint;

            TmpBullet.SetActive(true);

            TmpBullet.layer = 17 + PCS.GetPlayerNum();
            TmpBullet.GetComponentInChildren <HitScript>().SetOwner(PCS.GetPlayerNum());
            Color CtoChange = ES.GetColor(PCS.GetPlayerNum());
            CtoChange.r += .2f;
            CtoChange.g += .2f;
            CtoChange.b += .2f;
            TmpBullet.GetComponentInChildren <SpriteRenderer>().color = CtoChange;
            TmpBullet.GetComponentInChildren <HitScript>().SetOwner(PCS.GetPlayerNum());
            TmpBullet.GetComponentInChildren <SachelExplosionScript>().SetOwner(PCS.GetPlayerNum());
            TmpBullet.GetComponentInChildren <SachelExplosionScript>().SetBulletNumber(BulletNumber);
            BulletNumber++;
            CanShoot          = false;
            mines[numOfMines] = TmpBullet;
            numOfMines++;
            ShotTimer = 0;
        }
    }
Example #23
0
    public void Shoot(Vector3 GunPoint, Quaternion PointerRotation)
    {
        if (CanShoot && AS.CheckCanShootSecondary() && FirstShot)
        {
            RaycastHit2D hit        = Physics2D.Raycast(GunPoint, transform.up);
            Vector3      FinalPoint = hit.point;
            if (hit.point.x < transform.position.x)
            {
                FinalPoint.x += .1f;
            }
            else
            {
                FinalPoint.x -= .1f;
            }
            if (hit.point.y < transform.position.y)
            {
                FinalPoint.y += .1f;
            }
            else
            {
                FinalPoint.y -= .1f;
            }

            if (hit.collider != null)
            {
                SPS.playShoot();
                AS.ConsumeSecondaryAmmo();
                PrimaryBullet.SetActive(true);
                PrimaryBullet.transform.position = FinalPoint;
                PrimaryBullet.GetComponent <Rigidbody2D>().isKinematic = true;
                Color CtoChange = ES.GetColor(PCS.GetPlayerNum());
                CtoChange.r -= .1f;
                CtoChange.g -= .1f;
                CtoChange.b -= .1f;
                PrimaryBullet.GetComponentInChildren <SpriteRenderer>().color = CtoChange;
                CanShoot  = false;
                FirstShot = false;
                ShotTimer = 0;
            }
        }
        else if (CanShoot && AS.CheckCanShootSecondary())
        {
            RaycastHit2D hit        = Physics2D.Raycast(GunPoint, transform.up);
            Vector3      FinalPoint = hit.point;
            if (hit.point.x < transform.position.x)
            {
                FinalPoint.x += .1f;
            }
            else
            {
                FinalPoint.x -= .1f;
            }
            if (hit.point.y < transform.position.y)
            {
                FinalPoint.y += .1f;
            }
            else
            {
                FinalPoint.y -= .1f;
            }
            if (hit.collider != null)
            {
                SPS.playShoot();
                AS.ConsumeSecondaryAmmo();
                SecondaryBullet.SetActive(true);
                SecondaryBullet.transform.position = FinalPoint;
                SecondaryBullet.GetComponent <Rigidbody2D>().isKinematic = true;
                Color CtoChange = ES.GetColor(PCS.GetPlayerNum());
                WPS.ActivateWall(CtoChange);
                CtoChange.r -= .1f;
                CtoChange.g -= .1f;
                CtoChange.b -= .1f;
                SecondaryBullet.GetComponentInChildren <SpriteRenderer>().color = CtoChange;
            }
        }
    }
Example #24
0
    void checkReady()
    {
        if (NumOfPlayers == NumOfPlayersReady)
        {
            int  rNum = Random.Range(0, 100), x = 0;
            bool finding = true;

            while (finding)
            {
                if (rNum > 75 && LockedIn [3])
                {
                    if (ES.CheckLevelWins(3) > 0)
                    {
                        ES.ChangeLevelWins(3, -1);
                    }
                    else
                    {
                        x = 3;
                        ES.ChangeLevelWins(3, 1);
                        finding = false;
                    }
                }
                else if (rNum > 50 && rNum < 75 && LockedIn [2])
                {
                    if (ES.CheckLevelWins(2) > 0)
                    {
                        ES.ChangeLevelWins(2, -1);
                    }
                    else
                    {
                        x = 2;
                        ES.ChangeLevelWins(2, 1);
                        finding = false;
                    }
                }
                else if (rNum > 25 && rNum < 50 && LockedIn [1])
                {
                    if (ES.CheckLevelWins(1) > 0)
                    {
                        ES.ChangeLevelWins(1, -1);
                    }
                    else
                    {
                        x = 1;
                        ES.ChangeLevelWins(1, 1);
                        finding = false;
                    }
                }
                else if (rNum > 0 && rNum < 25 && LockedIn [0])
                {
                    if (ES.CheckLevelWins(0) > 0)
                    {
                        ES.ChangeLevelWins(0, -1);
                    }
                    else
                    {
                        x = 0;
                        ES.ChangeLevelWins(0, 1);
                        finding = false;
                    }
                }

                rNum = Random.Range(0, 100);
            }
            LevelToLoad = PlayerVote[x] + 4;
            AnimObjs [PlayerVote[x]].SetActive(true);

            Component[] PickedStageParts;
            PickedStageParts = AnimObjs[PlayerVote[x]].GetComponentsInChildren <Image> ();
            foreach (Image UIAnim in PickedStageParts)
            {
                UIAnim.color = ES.GetColor(x);
            }

            StartCoroutine(LevelTransitionAnimation());
            Invoke("TransitionSound", .5f);
            Invoke("StartNextLevel", 3f);
        }
    }
Example #25
0
 void OnEnable()
 {
     PS.startColor = ES.GetColor(PNum);
 }
 // Use this for initialization
 void Awake()
 {
     ES = GameObject.Find("EternalHolder").GetComponent <EternalScript> ();
     GetComponent <Image> ().color = ES.GetColor(PNum);
 }
Example #27
0
    IEnumerator RespawnSub(int PlayerNum)
    {
        yield return(new WaitForSeconds(.1f));

        Vector3 SpawnLocation = FindSpawn(PlayerNum);

        yield return(new WaitForSeconds(Delay));

        int        PrimaryWeapon, SecondaryWeapon;
        GameObject tmp;

        tmp = Instantiate(Character, SpawnLocation, Quaternion.identity) as GameObject;
        tmp = tmp.GetComponent <ChildReferenceScript> ().getObj();
        tmp.GetComponent <SpriteRenderer> ().color = ES.GetColor(PlayerNum);
        PrimaryWeapon   = ES.GetPrimary(PlayerNum);
        SecondaryWeapon = ES.GetSecondary(PlayerNum);


        tmp.GetComponent <PlayerControlScript> ().SetController(SpawnWithNoControls, PlayerNum);

        // set primary weapon
        if (PrimaryWeapon == 0)
        {
            tmp.AddComponent <AssultRifeScript> ();
        }
        else if (PrimaryWeapon == 1)
        {
            tmp.AddComponent <ShotgunScript> ();
        }
        else if (PrimaryWeapon == 2)
        {
            tmp.AddComponent <SniperProjectileScript> ();
        }
        else if (PrimaryWeapon == 3)
        {
            tmp.AddComponent <GrenadeLauncherScript> ();
        }
        else if (PrimaryWeapon == 4)
        {
            tmp.AddComponent <RngGunScript> ();
        }
        else if (PrimaryWeapon == 5)
        {
            tmp.AddComponent <BoomerangGunScript> ();
        }
        else if (PrimaryWeapon == 6)
        {
            tmp.AddComponent <LazerSniperScript> ();
        }
        else if (PrimaryWeapon == 7)
        {
            tmp.AddComponent <FireBowScript> ();
        }

        // set secondary weapon

        if (SecondaryWeapon == 0)
        {
            tmp.AddComponent <GrenadeScript> ();
        }
        else if (SecondaryWeapon == 1)
        {
            tmp.AddComponent <InterceptorScript> ();
        }
        else if (SecondaryWeapon == 2)
        {
            tmp.AddComponent <WallGunRevisedScript> ();
        }
        else if (SecondaryWeapon == 3)
        {
            tmp.AddComponent <SmokeBombScript> ();
        }
        else if (SecondaryWeapon == 4)
        {
            tmp.AddComponent <ShieldScript> ();
        }
        else if (SecondaryWeapon == 5)
        {
            tmp.AddComponent <TripMineScript> ();
        }

        yield return(new WaitForSeconds(Delay / 2));
    }