Esempio n. 1
0
    void Shoot()
    {
        if (gunLocked == true)
        {
            return;
        }
        else if (gunLocked == false)
        {
            //Instantiate projectile
            GameObject missileGameObject = (GameObject)Instantiate(missilePrefab, firePoint.position + new Vector3(0, 0, 36.4f), firePoint.rotation);
            Missile    missile           = missileGameObject.GetComponent <Missile>();
            v = player.GetComponent <Rigidbody>().velocity *fireForce;
            missile.GetComponent <Rigidbody>().velocity = v;

            // Configure the missile using it's own functions
            missile.Fire(spinSpeed);
            missile.SelfDestruct(missileLifeSpan);

            //lock the gun to prevent a glitch related to creating too many missiles at once, decrement ammo
            gunLocked = true;
            Invoke("Action", 0.1f);
            ammo--;

            //Biden changes faces when firing
            FaceSwitch biden = player.GetComponent <FaceSwitch>();
            biden.ChangeFace(2);

            // Biden says something
            FindObjectOfType <AudioManager>().PlayRandom();
        }
    }
Esempio n. 2
0
    void OnCollisionEnter(Collision collision)
    {
        //Obstacle Collision Stuff
        if (collision.collider.tag == "obstacle" && CentralData.putinMode == false)
        {
            ContactPoint contact         = collision.contacts[0];
            GameObject   deathExplosion  = Instantiate(ps, playerLocation.position, Quaternion.identity);
            GameObject   deathExplosion2 = Instantiate(ps2, playerLocation.position, Quaternion.identity);
            //Invoke("CreateCollisionParticles", 0.02f);

            //rb.AddTorque(Vector3.forward * .1f, ForceMode.VelocityChange);
            //int r1 = UnityEngine.Random.Range(2000, -2000);
            //int r2 = UnityEngine.Random.Range(-29990, -30000);

            rb.AddTorque(Vector3.left * 300000f);
            rb.AddTorque(Vector3.down * 300000f);

            FaceSwitch biden = this.GetComponent <FaceSwitch>();
            biden.ChangeFace(2);

            PlayerIsAlive = false;                             //Another Game Over event is when player falls off the Edge


            FindObjectOfType <GameplayManager>().EndGame();
            Debug.Log("Player Died!");
        }
        else if (collision.collider.tag == "ground")
        {
            hasJumped = false;
        }
    }