Ejemplo n.º 1
0
 public void SharingAbilityHandler()
 {
     for (int i = 0; i < Characters.Count; i++)
     {
         Character CurCharacter  = Characters[i];
         Character NextCharacter = Characters[((i + 1) % Characters.Count)];
         if (CurCharacter.SharingOn && !NextCharacter.Icon.activeSelf)
         {
             if (NextCharacter.InteractDreamRoll != null)
             {
                 DreamRoll dreamRoll = NextCharacter.InteractDreamRoll.GetComponent <DreamRoll>();
                 if (dreamRoll != null)
                 {
                     if (dreamRoll.Pushed)
                     {
                         dreamRoll.DisablePushMode();
                         NextCharacter.GetComponent <Animator>().SetBool("Pushing", false);
                     }
                 }
             }
             NextCharacter.ToogleSharedAbility(true);
             NextCharacter.Icon.SetActive(true);
         }
         else if (!CurCharacter.SharingOn)
         {
             NextCharacter.ToogleSharedAbility(false);
             NextCharacter.Icon.SetActive(false);
         }
     }
 }
Ejemplo n.º 2
0
    private void MoveInputHandler()
    {
        if (TelekinesisOn)
        {
            return;
        }
        if (ParkourOn || ParkourJumpingTime > 0)
        {
            return;
        }

        v   = Input.GetAxis("Vertical");
        h   = Input.GetAxis("Horizontal");
        Dir = h < 0 ? -1 : h > 0 ? 1 : Dir;

        // 좌우 키 눌렸을 때
        if (Input.GetKeyDown(KeyCode.LeftArrow))
        {
            SideKeyClicked(Key.Left);
        }
        else if (Input.GetKeyDown(KeyCode.RightArrow))
        {
            SideKeyClicked(Key.Right);
        }

        if (!Flying && Input.GetKeyDown(KeyCode.UpArrow) && !Pushing)
        {
            actionState = (actionState | ActionState.Jump);
        }

        // 밀기
        if (!Flying && InteractDreamRoll != null && Input.GetKeyDown(KeyCode.Q))
        {
            DreamRoll dreamRoll = InteractDreamRoll.GetComponent <DreamRoll>();
            if (dreamRoll != null)
            {
                if (dreamRoll.Pushed)
                {
                    dreamRoll.DisablePushMode();
                    Anim.SetBool("Pushing", false);
                }
                else
                {
                    dreamRoll.EnablePushMode(gameObject);
                    Anim.SetBool("Pushing", true);
                }
            }
        }
        if (!Pushing)
        {
            Flip();
        }
    }
Ejemplo n.º 3
0
    private void AbilityInputHandler()
    {
        if (HasTelekinesisAbility && !Flying)
        {
            if (Input.GetKeyDown(KeyCode.W))
            {
                TelekinesisOn = !TelekinesisOn;
                Telekinesis.SetActive(TelekinesisOn);
                Anim.SetBool("Walking", false);
                Anim.SetBool("Dashing", false);
                if (InteractDreamRoll != null && TelekinesisOn)
                {
                    DreamRoll dreamRoll = InteractDreamRoll.GetComponent <DreamRoll>();
                    if (dreamRoll != null)
                    {
                        if (dreamRoll.Pushed)
                        {
                            dreamRoll.DisablePushMode();
                            Anim.SetBool("Pushing", false);
                        }
                    }
                }
                Anim.SetBool("Kinesis", TelekinesisOn);
                DashTime = 0f;
            }
        }
        if (HasParkourAbility && EnoughFlyToParkour)
        {
            if (!ShouldFallPakour)
            {
                if ((HitLeftWall && Dir == -1) || (HitRightWall && Dir == 1))
                {
                    if (!ParkourOn)
                    {
                        StopDash();
                        if (HitLeftWall)
                        {
                            Anim.SetBool("PakourStandingLeft", true);
                        }
                        else if (HitRightWall)
                        {
                            Anim.SetBool("PakourStandingRight", true);
                        }
                        ParkourTime = 1f;
                        rigidbody2D.gravityScale = 0f;
                        h   = v = 0;
                        Dir = Dir == 1 ? -1 : 1;
                        Flip();
                    }
                    ParkourOn = true;
                }
            }
        }

        if (ParkourTime > 0f)
        {
            ParkourTime         -= Time.deltaTime;
            ParkourJumpingTime   = 0f;
            rigidbody2D.velocity = Vector2.zero;

            if (Input.GetKeyDown(KeyCode.Q))
            {
                ParkourTime = 0f;
                ParkourOn   = false;
                rigidbody2D.gravityScale = 1f;
                ParkourJumpingTime       = 2f;
                Anim.SetBool("PakourStandingRight", false);
                Anim.SetBool("PakourStandingLeft", false);
            }
            else if (ParkourTime <= 0f)
            {
                ParkourTime = 0f;
                ParkourOn   = false;
                rigidbody2D.gravityScale = 1f;
                ShouldFallPakour         = true;
                StopPakourJump();
                Anim.SetBool("PakourStandingRight", false);
                Anim.SetBool("PakourStandingLeft", false);
            }
        }
    }