Esempio n. 1
0
    private void LateUpdate()
    {
        if (!death)
        {
            if (isWakeUp)
            {
                if (!canMove && !getDamage)
                {
                    anim.ChangeAnimation("rise");
                }

                if (getDamage)
                {
                    anim.ChangeAnimation("getDamage");
                }


                if (canMove && !isAttaking)
                {
                    Move(speed);
                    anim.ChangeAnimation("walk");
                }

                if (isAttaking && !getDamage)
                {
                    anim.ChangeAnimation("bit");
                }
            }
        }
    }
Esempio n. 2
0
    // Update is called once per frame
    void Update()
    {
        if (IsMoving && IsGrounded)
        {
            anim.ChangeAnimation("Move");
            if (LookLeft)
            {
                Slimey.transform.position -= Slimey.transform.right * MoveSpeed * Time.deltaTime;
            }
            else
            {
                Slimey.transform.position += Slimey.transform.right * MoveSpeed * Time.deltaTime;
            }

            if (anim.frame == 7)
            {
                IsMoving = false;
            }
        }

        if (IsMoving == false && IsFrozen == false)
        {
            anim.ChangeAnimation("Idle");
            IdleTime--;
        }

        if (IdleTime == 0)
        {
            IsMoving = true;
            IdleTime = 20;
        }

        if (IsFrozen)
        {
            IsKillable = true;
            FreezeTimer--;
            if (FreezeTimer == 0)
            {
                IsMoving   = true;
                IsFrozen   = false;
                IsKillable = false;
            }
        }
        if (Slimey.transform.position.y <= -20)
        {
            Destroy(this.gameObject);
        }
        if (Dying)
        {
            DieFrames--;
            anim.ChangeAnimation("Die");
            IsMoving = false;
            if (DieFrames == 0)
            {
                Destroy(this.gameObject);
            }
        }
    }
Esempio n. 3
0
 public void Start()
 {
     anim   = GetComponent <AnimationControllerCustom>();
     render = GetComponent <SpriteRenderer>();
     rb     = GetComponent <Rigidbody2D>();
     anim.ChangeAnimation("idle");
 }
Esempio n. 4
0
 public void Start()
 {
     anim         = GetComponent <AnimationControllerCustom>();
     render       = GetComponent <SpriteRenderer>();
     rb           = GetComponent <Rigidbody2D>();
     attackvision = GetComponentInChildren <AttackVision>();
     direcction   = 1;
     anim.ChangeAnimation("idle");
     getDamage = false;
 }
Esempio n. 5
0
    public void LateUpdate()
    {
        //AGREGAR ANIMACION DE RECBIR DAÑO Y SU FUNCION

        if (!isGettingDamage)
        {
            if (isrunning)
            {
                anim.ChangeAnimation("walknormal");
            }



            if (iswalkinglow)
            {
                anim.ChangeAnimation("walklow");
            }

            if (rb.velocity.x == 0)
            {
                ismoving = false;
            }



            if (!ismoving)
            {
                anim.ChangeAnimation("idle");
            }

            if (isjumping)
            {
                if (rb.velocity.x == 0)
                {
                    anim.ChangeAnimation("jumpup");
                }
                else
                {
                    anim.ChangeAnimation("jumpfront");
                }
            }
        }
    }
Esempio n. 6
0
 public void Start()
 {
     feets  = GetComponentInParent <Janna>();
     anim   = GetComponent <AnimationControllerCustom>();
     render = GetComponent <SpriteRenderer>();
     //feets.rb = GetComponent<Rigidbody2D>();
     gunActive = true;
     anim.ChangeAnimation("idle");
     canHurt = true;
 }
Esempio n. 7
0
    // Update is called once per frame
    void Update()
    {
        if (Frozen == true)
        {
            anim.ChangeAnimation("Frozen");
            ActivateHitCollider();
            ThawCountdown--;
        }
        if (ThawCountdown <= 0)
        {
            Frozen        = false;
            ThawCountdown = 600;
        }

        if (Frozen == false)
        {
            anim.ChangeAnimation("Normal");
            DeactivateHitCollider();
        }
    }
Esempio n. 8
0
    private void Start()
    {
        anim   = GetComponent <AnimationControllerCustom>();
        render = GetComponent <SpriteRenderer>();
        rb     = GetComponentInParent <Rigidbody2D>();

        player = GetComponentInParent <Character>();
        anim.ChangeAnimation(AnimationName.feet_Idle);

        isIdle = true;
    }
Esempio n. 9
0
 public void Dashing()
 {
     anim.ChangeAnimation("Dash");
     this.transform.position += this.transform.right * 14 * Time.deltaTime;
     timer2 -= 1 * Time.deltaTime;
     if (timer2 > 1.5f)
     {
         this.transform.position += this.transform.up * 8 * Time.deltaTime;
     }
     if (timer2 < 1f)
     {
         this.transform.position -= this.transform.up * 8 * Time.deltaTime;
     }
 }
Esempio n. 10
0
    private void LateUpdate()
    {
        if (isJumping)
        {
            //Debug.Log(rb.velocity.x );

            if (rb.velocity.x == 0)
            {
                anim.ChangeAnimation(AnimationName.feet_jumpUp);
            }
            else
            {
                anim.ChangeAnimation(AnimationName.feet_jumpFront);
            }
        }

        else if (ismoving)
        {
            if (iswalking)
            {
                anim.ChangeAnimation(AnimationName.feet_walkNormaly);
            }
            else if (iswalkingslowly)
            {
                anim.ChangeAnimation(AnimationName.feet_walkSlowly);
            }
            else if (isrunning)
            {
                anim.ChangeAnimation(AnimationName.feet_run);
            }
            else if (isDamageWalk)
            {
                anim.ChangeAnimation(AnimationName.feet_walkDamage);
            }
        }



        else if (!ismoving)
        {
            anim.ChangeAnimation(AnimationName.feet_Idle);
        }
    }
Esempio n. 11
0
 public void Hop()
 {
     anim.ChangeAnimation("Idle");
     rb.AddForce(Vector2.up * 50, ForceMode2D.Impulse);
     boxc.enabled = false;
 }
Esempio n. 12
0
    void Update()
    {
        lifeBar.fillAmount = Life * 1 / MaxLife;

        if (Life <= 0)
        {
            Dead = true;
        }
        if (Dead)
        {
            Destroy(this.gameObject);
            Lives--;
            if (Lives > 0)
            {
                Life = MaxLife;
            }
        }
        if (Lives == 0)
        {
            SceneManager.LoadScene("Intro");
        }

        if (Hero.transform.position.y <= -20)
        {
            Dead = true;
        }

        if (Jumping)
        {
            anim.ChangeAnimation("Jump");
            canJump = false;
        }

        if (Casting)
        {
            if (Running == false)
            {
                anim.ChangeAnimation("Cast");
            }

            if (SpellMode == 1)
            {
                if (FireAmount < 10)
                {
                    CastFire();
                    FireAmount++;
                }
            }
            if (SpellMode == 2)
            {
                if (IceAmount < 1 && CanIceAppear == true)
                {
                    CastIce();
                    IceAmount++;
                }
                if (IceTime > 0)
                {
                    IceTime--;
                }
            }
            if (SpellMode == 3)
            {
                if (LightningAmount < 1)
                {
                    CastLightning();
                    LightningAmount++;
                }
            }
        }
        else if (Casting == false)
        {
            FireAmount = 0;
        }

        if (Running && canRun)
        {
            if (Jumping == false && Ducking == false)
            {
                anim.ChangeAnimation("Run");
            }

            if (LookLeft)
            {
                Hero.transform.position -= Hero.transform.right * MoveSpeed * Time.deltaTime;
            }
            else if (LookLeft == false)
            {
                Hero.transform.position += Hero.transform.right * MoveSpeed * Time.deltaTime;
            }
        }

        if (Ducking)
        {
            anim.ChangeAnimation("Duck");
            //reducir el hitbox
            canRun = false;
        }
        else
        {
            canRun = true;
        }

        if (Flinching)
        {
            anim.ChangeAnimation("Hit");
            InvulFrames--;
            Hero.transform.position += -Hero.transform.right * 0.3f * Time.deltaTime;
            canRun  = false;
            canJump = false;
            SoundManager.instance.Play(SoundID.HIT, false);
            if (InvulFrames == 0)
            {
                anim.ChangeAnimation("Idle");
                Flinching     = false;
                InvulFrames   = 60;
                CanGetDamaged = true;
                canRun        = true;
                canJump       = true;
            }
        }

        if (Running == false && Jumping == false && Casting == false && Ducking == false && Flinching == false)
        {
            anim.ChangeAnimation("Idle");
        }
    }
Esempio n. 13
0
    private void LateUpdate()
    {
        if (gunActive)
        {
            if (isGettingDamage)
            {
                anim.ChangeAnimation("getDamageGun");
            }
            else
            {
                if (isDowning)
                {
                    if (isShooting && !select1)
                    {
                        anim.ChangeAnimation(AnimationName.down_gun_shoot);
                    }

                    else if (isAttackingMelee)
                    {
                        anim.ChangeAnimation(AnimationName.down_gun_attackMelee_stick);
                    }
                    else if (isAttackingMelee2)
                    {
                        anim.ChangeAnimation(AnimationName.down_gun_attackMelee_axe);
                    }
                    else if (isAttackingMelee3)
                    {
                        anim.ChangeAnimation(AnimationName.down_gun_attackMelee_kick);
                    }
                    else if (isThrowing)
                    {
                        anim.ChangeAnimation(AnimationName.down_gun_throw);
                    }
                    else if (select1)
                    {
                        anim.ChangeAnimation(AnimationName.down_selectGun);
                    }
                    else if (isMoving)
                    {
                        anim.ChangeAnimation(AnimationName.down_gun_walk);
                    }
                    else
                    {
                        anim.ChangeAnimation(AnimationName.down_gun_idle);
                    }
                }
                else if (isAttakcingMelee4)
                {
                    anim.ChangeAnimation(AnimationName.standup_gun_kick);
                }
                else
                {
                    anim.ChangeAnimation("standup_shotgun_idle");
                }
            }
        }

        if (gunShotActive)
        {
            if (isDowning)
            {
                if (isShooting && !select2)
                {
                    anim.ChangeAnimation(AnimationName.down_gunshot_shoot);
                }

                else if (isAttackingMelee)
                {
                    anim.ChangeAnimation(AnimationName.down_shotgun_attackMelee_stick);
                }
                else if (isAttackingMelee2)
                {
                    anim.ChangeAnimation(AnimationName.down_shotgun_attackMelee_axe);
                }
                else if (isAttackingMelee3)
                {
                    anim.ChangeAnimation(AnimationName.down_shotgun_attackMelee_kick);
                }
                else if (isThrowing)
                {
                    anim.ChangeAnimation(AnimationName.down_shotgun_throw);
                }
                else if (select2)
                {
                    anim.ChangeAnimation(AnimationName.down_shotgun_selectShotGun);
                }
                else if (isMoving)
                {
                    anim.ChangeAnimation(AnimationName.down_gunshot_walk);
                }
                else
                {
                    anim.ChangeAnimation(AnimationName.down_gunshot_idle);
                }
            }
            else
            {
                if (isAttakcingMelee4)
                {
                    anim.ChangeAnimation(AnimationName.standup_shotgun_attackmelee_kick);
                }
            }
        }
    }
Esempio n. 14
0
    // Update is called once per frame
    void Update()
    {
        Scene  currentScene = SceneManager.GetActiveScene();
        string sceneName    = currentScene.name;

        if (dif.difficulty > 0)
        {
            timer -= 1 * Time.deltaTime;
            if (timer < 0)
            {
                SpawnRocks();
            }
        }

        if (Life == 0)
        {
            Dying = true;
        }

        if (Walking)
        {
            anim.ChangeAnimation("Walking");
            if (LookLeft)
            {
                Golem.transform.position -= Golem.transform.right * WalkSpeed * Time.deltaTime;
            }
            else
            {
                Golem.transform.position += Golem.transform.right * WalkSpeed * Time.deltaTime;
            }

            if (anim.frame == 3)
            {
                WalkSpeed = 0;
                SoundManager.instance.Play(SoundID.GOLEMWALK);
            }
            else if (anim.frame == 9)
            {
                WalkSpeed = 0;
                SoundManager.instance.Play(SoundID.GOLEMWALK);
            }
        }

        if (WalkSpeed == 0)
        {
            IdleTime--;
        }

        /*        if (Walking == false && DamageFlinch == false && Dying == false)
         *      {
         *          anim.ChangeAnimation("Idle");
         *          IdleTime--;
         *      }*/

        if (IdleTime <= 0 && DamageFlinch == false)
        {
            //Walking = true;
            WalkSpeed = 2;
            IdleTime  = 20;
        }

        if (Blocking)
        {
            anim.ChangeAnimation("Block");
            if (LookLeft)
            {
                Golem.transform.position += Golem.transform.right * 0.3f * Time.deltaTime;
            }
            else
            {
                Golem.transform.position -= Golem.transform.right * 0.3f * Time.deltaTime;
            }
            BlockFrames--;
            Walking = false;
            SoundManager.instance.Play(SoundID.BLOCK);
            if (BlockFrames == 0)
            {
                anim.ChangeAnimation("Idle");
                Blocking    = false;
                BlockFrames = 60;
                Walking     = true;
            }
        }

        if (DamageFlinch)
        {
            anim.ChangeAnimation("Hit");
            if (LookLeft)
            {
                Golem.transform.position += Golem.transform.right * 0.3f * Time.deltaTime;
            }
            else
            {
                Golem.transform.position -= Golem.transform.right * 0.3f * Time.deltaTime;
            }
            Walking = false;
            InvulFrames--;
            Heat = 0;
            if (InvulFrames == 0)
            {
                anim.ChangeAnimation("Idle");
                DamageFlinch  = false;
                InvulFrames   = 60;
                CanGetDamaged = true;
                Walking       = true;
            }
        }

        if (Hitting)
        {
            anim.ChangeAnimation("Attack");
            if (anim.frame == 7)
            {
                Hitting = false;
                Walking = true;
            }
        }


        if (Golem.transform.position.y <= -20)
        {
            Destroy(this.gameObject);
        }

        if (Dying)
        {
            anim.ChangeAnimation("Dead");
            DieFrames--;
            CanGetDamaged = false;

            if (DieFrames == 0)
            {
                Destroy(this.gameObject);

                if (sceneName == "Level")
                {
                    GameObject Orb = GameObject.Instantiate(ORB);
                    Orb.transform.position = this.transform.position;
                    SoundManager.instance.Stop(SoundID.BOSS);
                    SoundManager.instance.Play(SoundID.VICTORY, true, 0.3f);
                }
            }
        }
    }
Esempio n. 15
0
    private void AnimationControlBody()
    {
        if (gunActive)
        {
            if (select1)
            {
                anim.ChangeAnimation(AnimationName.gun_selectGun);
            }


            else if (isShooting)
            {
                anim.ChangeAnimation(AnimationName.gun_shoot);
            }
            else if (isAttackingMelee && !isShooting)
            {
                anim.ChangeAnimation(AnimationName.gun_attackMelee_stick);
            }
            else if (isAttackingMelee2 && !isShooting)
            {
                anim.ChangeAnimation(AnimationName.gun_attackMelee_axe);
            }
            else if (isReloading && !isShooting)
            {
                anim.ChangeAnimation(AnimationName.gun_reload);
            }
            else if (isThrowing)
            {
                anim.ChangeAnimation(AnimationName.gun_throw);
            }



            else if (feets.isJumping)
            {
                if (feets.rb.velocity.x == 0)
                {
                    anim.ChangeAnimation(AnimationName.gun_jumpUp);
                }
                else
                {
                    anim.ChangeAnimation(AnimationName.gun_jumpFront);
                }
            }

            else if (!feets.isJumping)
            {
                anim.ChangeAnimation(AnimationName.gun_idle);
            }

            else if (feets.ismoving)
            {
                if (feets.iswalking)
                {
                    anim.ChangeAnimation(AnimationName.gun_walk);
                }
            }

            else
            {
                anim.ChangeAnimation(AnimationName.gun_idle);
            }
        }



        else if (gunShotActive)
        {
            if (select2)
            {
                anim.ChangeAnimation(AnimationName.shotGun_selectGun);
            }

            else
            {
                if (isShooting)
                {
                    anim.ChangeAnimation(AnimationName.shotGun_shoot);
                }
                else if (isAttackingMelee && !isShooting)
                {
                    anim.ChangeAnimation(AnimationName.shotGun_attackMelee_stick);
                }
                else if (isAttackingMelee2 && !isShooting)
                {
                    anim.ChangeAnimation(AnimationName.shotGun_attackMelee_axe);
                }
                else if (isReloading && !isShooting)
                {
                    anim.ChangeAnimation(AnimationName.shotGun_reload);
                }
                else if (isThrowing)
                {
                    anim.ChangeAnimation(AnimationName.shotGun_throw);
                }



                else if (feets.isJumping)
                {
                    if (feets.rb.velocity.x == 0)
                    {
                        anim.ChangeAnimation(AnimationName.shotGun_jumpUp);
                    }
                    else
                    {
                        anim.ChangeAnimation(AnimationName.shotGun_jumpFront);
                    }
                }

                else if (!feets.isJumping)
                {
                    anim.ChangeAnimation(AnimationName.shotGun_idle);
                }

                else if (feets.ismoving)
                {
                    if (feets.iswalking)
                    {
                        anim.ChangeAnimation(AnimationName.shotGun_walk);
                    }
                }

                else
                {
                    anim.ChangeAnimation(AnimationName.shotGun_idle);
                }
            }
        }
    }
Esempio n. 16
0
    // Update is called once per frame
    void Update()
    {
        if (Flying)
        {
            if (DamageFlinch == false && Blocking == false && Dying == false && LookLeft == true)
            {
                Goyle.transform.position -= Goyle.transform.right * Flyspeed * Time.deltaTime;
            }
            else if (DamageFlinch == false && Blocking == false && Dying == false && LookLeft == false)
            {
                Goyle.transform.position += Goyle.transform.right * Flyspeed * Time.deltaTime;
            }
            if (DamageFlinch == false && Blocking == false && Dying == false && FlyDown == true)
            {
                Goyle.transform.position -= Goyle.transform.up * Flyspeed * Time.deltaTime;
            }
            else if (DamageFlinch == false && Blocking == false && Dying == false && FlyDown == false)
            {
                Goyle.transform.position += Goyle.transform.up * Flyspeed * Time.deltaTime;
            }
            SoundManager.instance.Play(SoundID.WINGS, true);
        }

        if (dif.difficulty > 0)
        {
            if (timer < 0)
            {
                Shield.SetActive(!Shield.activeSelf); timer = maxTimer;
            }
            else
            {
                timer -= 1 * Time.deltaTime;
            }
            if (Shield.activeSelf)
            {
                CanGetDamaged = false;
            }
            else
            {
                CanGetDamaged = true;
            }
        }
        else
        {
            Shield.SetActive(false);
        }


        if (transform.position.x < target.transform.position.x - 3)
        {
            transform.localScale = new Vector3(-5, 5, 0);
            LookLeft             = false;
        }
        else if (transform.position.x > target.transform.position.x + 3)
        {
            transform.localScale = new Vector3(5, 5, 0);
            LookLeft             = true;
        }

        if (transform.position.y < target.transform.position.y - 1)
        {
            FlyDown = false;
        }
        else if (transform.position.y > target.transform.position.y + 1)
        {
            FlyDown = true;
        }


        if (Life <= 0)
        {
            Dying = true;
        }

        if (DamageFlinch)
        {
            anim.ChangeAnimation("Damage");
            Goyle.transform.position += Goyle.transform.right * 0.3f * Time.deltaTime;
            InvulFrames--;
            if (InvulFrames == 0)
            {
                anim.ChangeAnimation("Idle");
                DamageFlinch  = false;
                InvulFrames   = 60;
                CanGetDamaged = true;
            }
        }

        if (Dying)
        {
            anim.ChangeAnimation("Dead");
            DieFrames--;
            CanGetDamaged             = false;
            Flying                    = false;
            Goyle.transform.position -= Goyle.transform.up * Flyspeed * 5 * Time.deltaTime;
            if (DieFrames == 0)
            {
                SoundManager.instance.Stop(SoundID.WINGS);
                Destroy(this.gameObject);
            }
        }

        if (Blocking)
        {
            anim.ChangeAnimation("Block");
            Goyle.transform.position += Goyle.transform.right * 0.3f * Time.deltaTime;
            CanGetDamaged             = false;
            InvulFrames--;
            Flying = false;
            if (InvulFrames == 0)
            {
                anim.ChangeAnimation("Idle");
                Blocking      = false;
                InvulFrames   = 60;
                CanGetDamaged = true;
                Flying        = true;
            }
        }
    }
Esempio n. 17
0
    public void LateUpdate()
    {
        if (shotGunActive)
        {
            if (doAction)
            {
                if (select2)
                {
                    anim.ChangeAnimation("selectshotgun");
                    if (render.flipX)
                    {
                        transform.localPosition = new Vector2(-0.009f, 0.066f);
                    }
                    else
                    {
                        transform.localPosition = new Vector2(0.009f, 0.082f);
                    }
                }
                if (isShooting)
                {
                    anim.ChangeAnimation("shootShotgun");
                    canHurt = false;
                }


                if (isReloading)
                {
                    anim.ChangeAnimation("reloadshotgun");
                    if (render.flipX)
                    {
                        transform.localPosition = new Vector2(-0.009f, 0.066f);
                    }
                    else
                    {
                        transform.localPosition = new Vector2(0.009f, 0.082f);
                    }
                }


                if (isAttackingMelee)
                {
                    anim.ChangeAnimation("attackmelee1shotgun");
                }

                if (isAttackingMelee2)
                {
                    anim.ChangeAnimation("attackmelee2shotgun");
                }
            }



            else if (!feets.ismoving && !doAction)
            {
                anim.ChangeAnimation("idleshotgun");

                if (render.flipX)
                {
                    transform.localPosition = new Vector2(0.007f, 0.062f);
                }
                else
                {
                    transform.localPosition = new Vector2(-0.001f, 0.062f);
                }
            }

            if (feets.ismoving && !doAction)
            {
                anim.ChangeAnimation("idleshotgun");
                if (render.flipX)
                {
                    transform.localPosition = new Vector2(0.007f, 0.062f);
                }
                else
                {
                    transform.localPosition = new Vector2(-0.001f, 0.062f);
                }
            }



            if (feets.isjumping)
            {
                if (feets.rb.velocity.x == 0 && !doAction)
                {
                    anim.ChangeAnimation("jumpupshotgun");
                    //transform.localPosition = new Vector2(0.002f, 0.19f);
                }

                else if (feets.rb.velocity.x != 0 && !doAction)
                {
                    anim.ChangeAnimation("jumpfrontshotgun");
                    //if (render.flipX) transform.localPosition = new Vector2(0.08f, 0.127f);
                    //else transform.localPosition = new Vector2(-0.065f, 0.134f);
                }

                else
                {
                    doAction = true;
                    //if (render.flipX) transform.localPosition = new Vector2(-0.001f, 0.076f);
                    //else transform.localPosition = new Vector2(-0.003f, 0.073f);
                }
            }
        }


        ActionsWithGun();
    }
Esempio n. 18
0
    // Update is called once per frame
    void Update()
    {
        Scene  currentScene = SceneManager.GetActiveScene();
        string sceneName    = currentScene.name;

        if (Idle == true)
        {
            anim.ChangeAnimation("Idle");
            IdleTime--;
            Dashing          = false;
            CastingFire      = false;
            CastingIce       = false;
            CastingLightning = false;
            SoundManager.instance.Play(SoundID.WINGS);
        }

        if (Dashing == true)
        {
            Idle             = false;
            CastingFire      = false;
            CastingIce       = false;
            CastingLightning = false;
            if (LookLeft == true)
            {
                Jamir.transform.position -= Jamir.transform.right * 8 * Time.deltaTime;
            }
            else if (LookLeft == false)
            {
                Jamir.transform.position += Jamir.transform.right * 8 * Time.deltaTime;
            }
            anim.ChangeAnimation("Dash");
            IdleTime = 120;
            SoundManager.instance.Stop(SoundID.WINGS);
        }

        if (Life <= 0)
        {
            Dying = true;
        }

        if (DamageFlinch)
        {
            anim.ChangeAnimation("Hit");
            CanGetDamaged             = false;
            Jamir.transform.position += Jamir.transform.right * 0.3f * Time.deltaTime;
            InvulFrames--;
            if (InvulFrames <= 0)
            {
                Idle          = true;
                DamageFlinch  = false;
                InvulFrames   = 60;
                CanGetDamaged = true;
            }
        }

        if (Blocking)
        {
            anim.ChangeAnimation("Block");
            Jamir.transform.position += Jamir.transform.right * 0.3f * Time.deltaTime;
            InvulFrames--;
            if (InvulFrames <= 0)
            {
                Idle        = true;
                Blocking    = false;
                InvulFrames = 60;
            }
        }

        if (Dying)
        {
            anim.ChangeAnimation("Dead");
            DieFrames--;
            if (DieFrames == 0)
            {
                GameObject Orb = GameObject.Instantiate(ORB);
                Orb.transform.position = this.transform.position;
                Destroy(this.gameObject);

                if (sceneName == "Level3")
                {
                    SoundManager.instance.Stop(SoundID.FINALBOSS);
                    SoundManager.instance.Play(SoundID.VICTORY, true, 0.3f);
                }
            }
        }

        if (CastingFire == true)
        {
            Idle             = false;
            Dashing          = false;
            CastingIce       = false;
            CastingLightning = false;
            anim.ChangeAnimation("Attack");
            CastingDuration--;
            if (FireballLimit < 1)
            {
                GameObject JamirFireball = GameObject.Instantiate(Fireball);
                JamirFireball.transform.position = this.transform.position;
                FireballLimit++;
            }
        }
        if (CastingIce == true)
        {
            Idle             = false;
            Dashing          = false;
            CastingFire      = false;
            CastingLightning = false;
            anim.ChangeAnimation("Cast2");
            CastingDuration--;
            GameObject Flakes = GameObject.Instantiate(Flake);
            Flakes.transform.position = this.transform.position;
            SoundManager.instance.Play(SoundID.ICE);
        }
        if (CastingLightning == true)
        {
            Idle        = false;
            Dashing     = false;
            CastingFire = false;
            CastingIce  = false;
            anim.ChangeAnimation("Cast1");
            CastingDuration--;
        }
        if (CastingDuration <= 0)
        {
            CastingFire      = false;
            CastingIce       = false;
            CastingLightning = false;
            FireballLimit    = 0;
            Idle             = true;
            IdleTime         = 120;
        }
        if (CastingLightning == false && CastingFire == false && CastingIce == false)
        {
            CastingDuration = 200;
        }
    }
Esempio n. 19
0
    // Update is called once per frame
    void Update()
    {
        Scene  currentScene = SceneManager.GetActiveScene();
        string sceneName    = currentScene.name;

        if (Idle == true)
        {
            anim.ChangeAnimation("Idle");
            IdleTime--;
            SlashAnimation = 30;
            JumpFrames     = 60;
        }
        if (Attacking == true)
        {
            Idle = false;
            SlashAnimation--;
        }
        if (SlashAnimation <= 0)
        {
            Idle      = true;
            Attacking = false;
        }

        if (Life <= 0)
        {
            Dying = true;
        }

        if (Blocking)
        {
            anim.ChangeAnimation("Block");
            Undyne.transform.position += Undyne.transform.right * 0.3f * Time.deltaTime;
            CanGetDamaged              = false;
            InvulFrames--;
            if (InvulFrames <= 0)
            {
                Idle          = true;
                Blocking      = false;
                InvulFrames   = 60;
                CanGetDamaged = true;
            }
        }

        if (DamageFlinch)
        {
            anim.ChangeAnimation("Hit");
            Undyne.transform.position += Undyne.transform.right * 0.3f * Time.deltaTime;
            InvulFrames--;
            if (InvulFrames <= 0)
            {
                Idle          = true;
                DamageFlinch  = false;
                InvulFrames   = 60;
                CanGetDamaged = true;
            }
        }
        if (Dying)
        {
            anim.ChangeAnimation("Dead");
            DieFrames--;
            CanGetDamaged = false;
            if (DieFrames == 0)
            {
                GameObject Orb = GameObject.Instantiate(ORB);
                Orb.transform.position = this.transform.position;
                Destroy(this.gameObject);

                if (sceneName == "Level2")
                {
                    SoundManager.instance.Stop(SoundID.BOSS);
                    SoundManager.instance.Play(SoundID.VICTORY, true, 0.3f);
                }
            }
        }

        if (Jumping)
        {
            JumpFrames--;
        }

        if (Dashing)
        {
            Dash();
        }

        Vector2 rayPos;

        rayPos = new Vector2(this.transform.position.x, this.transform.position.y + 1);

        RaycastHit2D checkwater;

        checkwater = Physics2D.Raycast(rayPos, Vector2.right, 1, MyLayerMask);
        Debug.DrawRay(rayPos, Vector2.right, Color.green);
        if (!checkwater.collider.gameObject)
        {
            Submerged = false;
        }
        else
        {
            Submerged = true;
        }
    }
Esempio n. 20
0
    // Update is called once per frame
    void Update()
    {
        if (dif.difficulty == 1)
        {
            if (electrified)
            {
                timer -= 1 * Time.deltaTime;
            }
            if (timer < 0)
            {
                ShootLightning();
            }
        }
        else if (dif.difficulty == 2)
        {
            timer -= 1 * Time.deltaTime;
            if (timer < 0)
            {
                ShootLightning();
            }
        }

        if (Life <= 0)
        {
            Dying = true;
        }

        if (AttackCooldown <= 0)
        {
            AttackCooldown = 0;
        }
        else
        {
            AttackCooldown--;
        }

        if (Blocking)
        {
            anim.ChangeAnimation("Block");
            Skelly.transform.position += Skelly.transform.right * 0.3f * Time.deltaTime;
            CanGetDamaged              = false;
            InvulFrames--;
            Walking = false;
            if (InvulFrames == 0)
            {
                anim.ChangeAnimation("Idle");
                Blocking      = false;
                InvulFrames   = 60;
                CanGetDamaged = true;
                Walking       = true;
            }
        }

        if (Attack)
        {
            Walking = false;
            anim.ChangeAnimation("Stab");
            StartUpframes--;
            if (StartUpframes <= 0)
            {
                ActivateHitCollider();
            }
            AttackFrames--;
            AttackCooldown = 60;
        }

        if (Skelly.transform.localScale == new Vector3(6, 6, 0) && transform.position.x <= target.transform.position.x + 3 && transform.position.x > target.transform.position.x && AttackCooldown == 0 && transform.position.y >= target.transform.position.y - 2 && transform.position.y <= target.transform.position.y + 2 && Attack == false)
        {
            Attack = true;
            SoundManager.instance.Play(SoundID.CUT, false);
        }
        else if (Skelly.transform.localScale == new Vector3(-6, 6, 0) && transform.position.x >= target.transform.position.x - 3 && transform.position.x < target.transform.position.x && AttackCooldown == 0 && transform.position.y >= target.transform.position.y - 2 && transform.position.y <= target.transform.position.y + 2 && Attack == false)
        {
            Attack = true;
            SoundManager.instance.Play(SoundID.CUT, false);
        }

        if (AttackFrames <= 0 && anim.frame == 4)
        {
            Attack        = false;
            Walking       = true;
            StartUpframes = 20;
            AttackFrames  = 25;
            DeactivateHitCollider();
            WalkSpeed = 4;
        }

        if (Walking)
        {
            anim.ChangeAnimation("Run");
            if (DamageFlinch == false && Blocking == false && Dying == false && LookLeft == true)
            {
                Skelly.transform.position -= Skelly.transform.right * WalkSpeed * Time.deltaTime;
            }
            else if (DamageFlinch == false && Blocking == false && Dying == false && LookLeft == false)
            {
                Skelly.transform.position += Skelly.transform.right * WalkSpeed * Time.deltaTime;
            }
        }

        if (DamageFlinch)
        {
            anim.ChangeAnimation("Damage");
            Skelly.transform.position += Skelly.transform.right * 0.3f * Time.deltaTime;
            InvulFrames--;
            DeactivateHitCollider();
            if (InvulFrames == 0)
            {
                anim.ChangeAnimation("Idle");
                DamageFlinch  = false;
                InvulFrames   = 60;
                CanGetDamaged = true;
            }
        }
        if (Dying)
        {
            anim.ChangeAnimation("Dead");
            DieFrames--;
            CanGetDamaged = false;
            DeactivateHitCollider();
            if (DieFrames == 0)
            {
                Destroy(this.gameObject);
            }
        }
        if (Skelly.transform.position.y <= -20)
        {
            Destroy(this.gameObject);
        }
    }
Esempio n. 21
0
 public void Stage1()
 {
     timer1 -= 1 * Time.deltaTime;
     anim.ChangeAnimation("Run");
     this.transform.position += this.transform.right * 5 * Time.deltaTime;
 }