Esempio n. 1
0
    //Update Method
    private void Update()
    {
        if (!alive)
        {
            if (playerAnimation.isEndOfDeathAnimation())
            {
                ControllerManager.Instance.sceneController.reloadScene();
                Destroy(this.gameObject);
            }
        }

        if (victory)
        {
            if (playerAnimation.isEndOfTeleportAnimation())
            {
                ControllerManager.Instance.sceneController.loadMainMenuScene();
                Destroy(this.gameObject);
            }
        }

        if (jumping)
        {
            playerAnimation.isEndOfDestroyAnimation();
            if (playerAnimation.isEndOfJumpingAnimation())
            {
                if (!riding)
                {
                    if (extraEgg != null)
                    {
                        extraEgg.destroyEgg(true);
                        playerAnimation.expendEgg();
                        riding   = true;
                        extraEgg = null;
                    }
                    else
                    {
                        playerAnimation.disableMount();
                    }
                }

                jumping             = false;
                collider.enabled    = true;
                playerInput.enabled = true;
            }
        }
        else if (invulnerable)
        {
            invulnerableTime -= Time.deltaTime;
            playerAnimation.flashSprite(riding);
            if (invulnerableTime <= 0f)
            {
                playerAnimation.flashSpriteTerminal(riding);
                invulnerable = false;
            }
        }
    }
Esempio n. 2
0
 private void Start()
 {
     extraEgg        = null;
     jumping         = false;
     riding          = false;
     victory         = false;
     alive           = true;
     playerAnimation = this.GetComponent <PlayerAnimation>();
     playerInput     = this.GetComponent <PlayerInput>();
     collider        = this.GetComponent <BoxCollider2D>();
     aManager        = FindObjectOfType <AudioManager>();
 }
Esempio n. 3
0
 //Dismount
 public void dismount()
 {
     if (!jumping)
     {
         invulnerable        = true;
         invulnerableTime    = 1f;
         riding              = false;
         jumping             = true;
         collider.enabled    = false;
         playerInput.enabled = false;
         bombType            = ControllerManager.Instance.bombController.simpleBomb;
         if (ControllerManager.Instance.extraEggsController.extraEggsCount() > 0)
         {
             extraEgg = ControllerManager.Instance.extraEggsController.getNextEgg().GetComponent <ExtraEgg>();
             extraEgg.expendEgg(this.transform.position);
             bombType = ControllerManager.Instance.bombController.pierceBomb;
         }
         playerAnimation.dismount(extraEgg);
     }
 }