示例#1
0
 void Start()
 {
     outerGlow     = transform.Find("Outer Glow").GetComponent <SpriteRenderer>();
     trailRenderer = GetComponent <TrailRenderer>();
     audioSource   = GetComponent <AudioSource>();
     audioSource2  = transform.Find("Glow").GetComponent <AudioSource>();
     audioSource3  = transform.Find("Outer Glow").GetComponent <AudioSource>();
     speedTrail    = transform.Find("SpeedTrail").GetComponent <SpeedTrail>();
     _orbitTarget  = CenterQirn.Instance.transform.position;
     //speedActualMax = _speedMinMax.Max;
     GameManager.Instance.GameStateChanged += Instance_GameStateChanged;
     GameManager.Instance.GameModeChanged  += Instance_GameModeChanged;
 }
示例#2
0
    void Update()
    {
        // Get the Rewired Player object for this player and keep it for the duration of the character's lifetime
        player = ReInput.players.GetPlayer(playerId);
        // Get/Process input functions
        GetInput();
        ProcessInput();
        Debug.Log(SoulCount);
        //stunned mechanic...if player is stunned and still alive do this
        if (stunned == true && dead == false)
        {
            animator.enabled = false;
            //make ths stun icon appear
            if (stunIconShow)
            {
                GameObject stun = (Instantiate(stunIcon, new Vector3(stunIconLoc.transform.position.x, stunIconLoc.transform.position.y), mainCamera.transform.rotation)) as GameObject;
                Destroy(stun, 2f);
                stunIconShow = false;
            }
            //make sure both the shields collider and its renderer are off, however do setActive it to false.
            shield.gameObject.GetComponent <PolygonCollider2D>().enabled = false;
            shield.gameObject.GetComponent <SpriteRenderer>().enabled    = false;
            //player can no longer move while dead.
            moveSpeed = 0f;
            //if the player is stunned, and it currently has its stun icon, make a call to UnStun method.
            if (stunIconToggle == true)
            {
                Invoke("UnStun", 2f);
                stunIconToggle = false;
            }
            rb.velocity = new Vector2(0f, 0f);
        }
        // If you are dead, turn off movement.
        if (dead == true)
        {
            rb.velocity = new Vector2(0f, 0f);
        }
        // Meleeing ability for the player
        if (meleeing)
        {
            GetComponent <Rigidbody2D>().velocity = -transform.up * moveSpeed * 3.5f;
            TrailPlay();
        }
        else
        {
            TrailStop();
        }
        // Shield power up...makes it very strong
        if (shieldPowerUp)
        {
            shield.GetComponent <FFAShieldScript>().cantBeStunned = true;
        }
        else if (!shieldPowerUp)
        {
            shield.GetComponent <FFAShieldScript>().cantBeStunned = false;
        }

        // Set the speed settings for the speed power up
        if (this.gameObject.CompareTag("Angel"))
        {
            if (GameObject.FindGameObjectWithTag("SpeedPowerUp") != null && GameObject.FindGameObjectWithTag("SpeedPowerUp").GetComponent <shotsPowerUp>().angelSpeedPowerUp)
            {
                if (!stunned && !dead)
                {
                    moveSpeed     = 20;
                    slowMoveSpeed = 10;
                    SpeedTrail.Play();
                }
            }
            else if (GameObject.FindGameObjectWithTag("SpeedPowerUp") == null && PlayerPrefs.GetInt("moveSpeedModifier") == 0)
            {
                if (!stunned && !dead)
                {
                    moveSpeed     = 10;
                    slowMoveSpeed = 5;
                    SpeedTrail.Stop();
                }
            }
            if (PlayerPrefs.GetInt("moveSpeedModifier") == 1)
            {
                moveSpeed     = 20;
                slowMoveSpeed = 10;
                SpeedTrail.Play();
            }
        }
        else if (this.gameObject.CompareTag("Demon"))
        {
            if (GameObject.FindGameObjectWithTag("SpeedPowerUp") != null && GameObject.FindGameObjectWithTag("SpeedPowerUp").GetComponent <shotsPowerUp>().demonSpeedPowerUp)
            {
                if (!stunned && !dead)
                {
                    moveSpeed = 20;
                    SpeedTrail.Play();
                }
            }
            else if (GameObject.FindGameObjectWithTag("SpeedPowerUp") == null && PlayerPrefs.GetInt("moveSpeedModifier") == 0)
            {
                if (!stunned && !dead)
                {
                    moveSpeed = 10;
                    SpeedTrail.Stop();
                }
            }
            if (PlayerPrefs.GetInt("moveSpeedModifier") == 1)
            {
                moveSpeed = 20;
                SpeedTrail.Play();
            }
        }
        //If youre invincible aka just spawned, set the circle around you to active
        if (invincible)
        {
            invincibleShield.SetActive(true);
        }
        else
        {
            invincibleShield.SetActive(false);
        }
    }
示例#3
0
    void Update()
    {
        // Get the Rewired Player object for this player and keep it for the duration of the character's lifetime
        player = ReInput.players.GetPlayer(playerId);
        // Get/Process input functions
        GetInput();
        ProcessInput();

        // If you have the flag, you can't fire or shield, and make the flag follow player.
        if (hasFlag == true)
        {
            canFire   = false;
            canShield = false;
            canMelee  = false;
            if (this.gameObject.CompareTag("Angel"))
            {
                DemonFlag.transform.position = this.gameObject.transform.position;
                DemonFlag.transform.rotation = this.gameObject.transform.rotation;
            }
            else if (this.gameObject.CompareTag("Demon"))
            {
                AngelFlag.transform.position = this.gameObject.transform.position;
                AngelFlag.transform.rotation = this.gameObject.transform.rotation;
            }
        }
        //stunned mechanic...if player is stunned and still alive do this
        if (stunned == true && dead == false)
        {
            animator.SetBool("Idle", false);
            animator.SetBool("Stunned", true);

            //make ths stun icon appear
            if (stunIconShow)
            {
                GameObject stun = (Instantiate(stunIcon, new Vector3(stunIconLoc.transform.position.x, stunIconLoc.transform.position.y), mainCamera.transform.rotation)) as GameObject;
                Destroy(stun, 2f);
                stunIconShow = false;
            }
            //make sure both the shields collider and its renderer are off, however do setActive it to false.
            shield.gameObject.GetComponent <PolygonCollider2D>().enabled = false;
            shield.gameObject.GetComponent <SpriteRenderer>().enabled    = false;
            //player can no longer move while dead.
            moveSpeed = 0f;
            //if the player is stunned, and it currently has its stun icon, make a call to UnStun method.
            if (stunIconToggle == true)
            {
                Invoke("UnStun", 2f);
                stunIconToggle = false;
            }
            rb.velocity = new Vector2(0f, 0f);
        }
        // If you are dead, turn off movement.
        if (dead == true)
        {
            rb.velocity = new Vector2(0f, 0f);
        }
        // Meleeing ability for the player
        if (meleeing)
        {
            //if meleeing move the player in a charge and release their trail
            GetComponent <Rigidbody2D>().velocity = -transform.up * moveSpeed * 3.5f;
            TrailPlay();
        }
        else
        {
            TrailStop();
        }
        // Shield power up...makes it very strong
        if (shieldPowerUp)
        {
            shield.GetComponent <ShieldScript>().cantBeStunned = true;
        }
        else if (!shieldPowerUp)
        {
            shield.GetComponent <ShieldScript>().cantBeStunned = false;
        }

        // Set the speed settings for the speed power up
        if (this.gameObject.CompareTag("Angel"))
        {
            if (GameObject.FindGameObjectWithTag("SpeedPowerUp") != null && GameObject.FindGameObjectWithTag("SpeedPowerUp").GetComponent <shotsPowerUp>().angelSpeedPowerUp)
            { //if the player is not stunned or dead but has the powerup move twice as fast
                if (!stunned && !dead)
                {
                    moveSpeed     = 20;
                    slowMoveSpeed = 10;
                    SpeedTrail.Play();
                }
            }//if the player isnt stunned or dead but has no powerup move normally
            else if (GameObject.FindGameObjectWithTag("SpeedPowerUp") == null && PlayerPrefs.GetInt("moveSpeedModifier") == 0)
            {
                if (!stunned && !dead)
                {
                    moveSpeed     = 10;
                    slowMoveSpeed = 5;
                    SpeedTrail.Stop();
                }
            } //this mode is for the modifier so the game isnt too crazy if played on powerups always on
            if (GameObject.FindGameObjectWithTag("SpeedPowerUp") == null && PlayerPrefs.GetInt("moveSpeedModifier") == 1)
            {
                if (!stunned && !dead)
                {
                    moveSpeed     = 15;
                    slowMoveSpeed = 8;
                }
            }
            // indicator for if the player has the shot power up
            if (GameObject.FindGameObjectWithTag("ShotPowerUp") != null && GameObject.FindGameObjectWithTag("ShotPowerUp").GetComponent <shotsPowerUp>().angelShotPowerUp)
            {
                shotPowerTrail.Play();
            }

            if (GameObject.FindGameObjectWithTag("ShotPowerUp") == null)
            {
                shotPowerTrail.Stop();
            }
        }
        else if (this.gameObject.CompareTag("Demon"))
        {
            if (GameObject.FindGameObjectWithTag("SpeedPowerUp") != null && GameObject.FindGameObjectWithTag("SpeedPowerUp").GetComponent <shotsPowerUp>().demonSpeedPowerUp)
            {
                if (!stunned && !dead)
                {
                    moveSpeed     = 20;
                    slowMoveSpeed = 10;
                    SpeedTrail.Play();
                }
            }
            else if (GameObject.FindGameObjectWithTag("SpeedPowerUp") == null && PlayerPrefs.GetInt("moveSpeedModifier") == 0)
            {
                if (!stunned && !dead)
                {
                    moveSpeed     = 10;
                    slowMoveSpeed = 5;
                    SpeedTrail.Stop();
                }
            }
            if (GameObject.FindGameObjectWithTag("SpeedPowerUp") == null && PlayerPrefs.GetInt("moveSpeedModifier") == 1)
            {
                if (!stunned && !dead)
                {
                    moveSpeed     = 15;
                    slowMoveSpeed = 8;
                }
            }

            if (GameObject.FindGameObjectWithTag("ShotPowerUp") != null && GameObject.FindGameObjectWithTag("ShotPowerUp").GetComponent <shotsPowerUp>().demonShotPowerUp)
            {
                shotPowerTrail.Play();
            }

            if (GameObject.FindGameObjectWithTag("ShotPowerUp") == null)
            {
                shotPowerTrail.Stop();
            }
        }
        //If youre invincible aka just spawned, set the circle around you to active
        if (invincible)
        {
            invincibleShield.SetActive(true);
        }
        else
        {
            invincibleShield.SetActive(false);
        }
    }