Beispiel #1
0
    void ComboAttacks()
    {
        //Kick
        if (Input.GetKeyDown(KeyCode.K))
        {
            if (current_Combo_State == ComboState.PUNCH_3 || current_Combo_State == ComboState.KICK_2)
            {
                return;
            }

            if (current_Combo_State == ComboState.NONE || current_Combo_State == ComboState.PUNCH_1 || current_Combo_State == ComboState.PUNCH_2)
            {
                current_Combo_State = ComboState.KICK_1;
            }
            else if (current_Combo_State == ComboState.KICK_1)
            {
                current_Combo_State++;
            }
            activateTimerToReset = true;
            current_Combo_Timer  = default_Combo_Timer;

            if (current_Combo_State == ComboState.KICK_1)
            {
                _anim.Kick_1();
            }

            if (current_Combo_State == ComboState.KICK_2)
            {
                _anim.Kick_2();
            }
        }
    }
Beispiel #2
0
    void ComboAttacks()
    {
        if (Input.GetKeyDown(KeyCode.Z))
        {
            if (current_Combo_State == ComboState.PUNCH_3 ||
                current_Combo_State == ComboState.KICK_1 ||
                current_Combo_State == ComboState.KICK_2)
            {
                return;
            }

            current_Combo_State++;
            activateTimerToReset = true;
            current_Combo_Timer  = default_Combo_Timer;

            if (current_Combo_State == ComboState.PUNCH_1)
            {
                player_Anim.Punch_1();
            }
            if (current_Combo_State == ComboState.PUNCH_2)
            {
                player_Anim.Punch_2();
            }
            if (current_Combo_State == ComboState.PUNCH_3)
            {
                player_Anim.Punch_3();
            }
        } //punch
        if (Input.GetKeyDown(KeyCode.X))
        {
            if (current_Combo_State == ComboState.KICK_2 ||
                current_Combo_State == ComboState.PUNCH_3)
            {
                return;
            }

            if (current_Combo_State == ComboState.NONE ||
                current_Combo_State == ComboState.PUNCH_1 ||
                current_Combo_State == ComboState.PUNCH_2)
            {
                current_Combo_State = ComboState.KICK_1;
            }
            else if (current_Combo_State == ComboState.KICK_1)
            {
                current_Combo_State++;
            }

            activateTimerToReset = true;
            current_Combo_Timer  = default_Combo_Timer;

            if (current_Combo_State == ComboState.KICK_1)
            {
                player_Anim.Kick_1();
            }
            if (current_Combo_State == ComboState.KICK_2)
            {
                player_Anim.Kick_2();
            }
        } //kick
    }
    private void OnKickAttack()
    {
        if (comboState == ComboState.PUNCH3 || comboState == ComboState.KICK2)
        {
            return;
        }

        if (comboState < (ComboState)3)
        {
            comboState = ComboState.KICK1;
        }
        else if (comboState == ComboState.KICK1)
        {
            comboState++;
        }

        comboTimer  = defaultTimer;
        activeTimer = true;

        if (comboState == ComboState.KICK1)
        {
            animation.Kick1();
        }
        else if (comboState == ComboState.KICK2)
        {
            animation.Kick2();
        }
    }
 private void JumpRangedAttack()
 {
     if (readyForAttackInput && currentCombo == GetDefaultState())
     {
         currentCombo = ((DefaultComboState)currentCombo).JumpRangedAttack();
     }
 }
 private void CrouchKick()
 {
     if (readyForAttackInput && currentCombo == GetDefaultState())
     {
         currentCombo = ((DefaultComboState)currentCombo).CrouchKick();
     }
 }
Beispiel #6
0
 // Update is called once per frame
 void Update()
 {
     time += Time.deltaTime;
     if (word.transform.localScale.x < BigSize && mode == ComboState.Init)
     {
         word.transform.localScale       += new Vector3(speed, speed, 0);
         word_shine.transform.localScale += new Vector3(speed, speed, 0);
         speed += 0.002f;
         if (word.transform.localScale.x > BigSize)
         {
             mode = ComboState.Shine;
         }
     }
     else if (mode == ComboState.Shine)
     {
         word.transform.localScale       = new Vector3(normalSize, normalSize, 0f);
         word_shine.transform.localScale = new Vector3(normalSize, normalSize, 0f);
     }
     else if (mode == ComboState.Destory)
     {
         Destroy(gameObject);
     }
     if (time > DestoryTime)
     {
         Destroy(gameObject);
     }
 }
Beispiel #7
0
    void ComboAttack()
    {
        if (Input.GetKeyDown(KeyCode.Z))
        {
            if (current_Combo_state == ComboState.PUNCH_3 || current_Combo_state == ComboState.KICK_1 ||
                current_Combo_state == ComboState.KICK_2)
            {
                return;
            }

            current_Combo_state++;
            activateTimertoAttack = true;
            current_Combo_timer   = defaul_Combo_timer;

            if (current_Combo_state == ComboState.PUNCH_1)
            {
                player_anim.Punch_1();
            }
            if (current_Combo_state == ComboState.PUNCH_2)
            {
                player_anim.Punch_2();
            }
            if (current_Combo_state == ComboState.PUNCH_3)
            {
                player_anim.Punch_3();
            }
        }
        if (Input.GetKeyDown(KeyCode.X))
        {
            if (current_Combo_state == ComboState.PUNCH_3 ||
                current_Combo_state == ComboState.KICK_2)
            {
                return;
            }

            if (current_Combo_state == ComboState.NONE ||
                current_Combo_state == ComboState.PUNCH_1 ||
                current_Combo_state == ComboState.PUNCH_2)
            {
                current_Combo_state = ComboState.KICK_1;
            }
            else if (current_Combo_state == ComboState.KICK_1)
            {
                current_Combo_state++;
            }

            activateTimertoAttack = true;
            current_Combo_timer   = defaul_Combo_timer;

            if (current_Combo_state == ComboState.KICK_1)
            {
                player_anim.Kick_1();
            }
            if (current_Combo_state == ComboState.KICK_2)
            {
                player_anim.Kick_2();
            }
        }
    }
Beispiel #8
0
 // Use this for initialization
 void Start()
 {
     time  = 0;
     speed = 0.002f;
     mode  = ComboState.Init;
     word.transform.localScale       = new Vector3(normalSize, normalSize, 0f);
     word_shine.transform.localScale = new Vector3(normalSize, normalSize, 0f);
 }
 public ComboState(AttackManager attackManager)
 {
     this.attackManager = attackManager;
     if (!(GetType().Equals(typeof(EndComboState))))    //Stops infinite recursion in EndComboState constructor
     {
         endComboState = new EndComboState(attackManager);
     }
 }
 private void StandingPunch()
 {
     if (readyForAttackInput)
     {
         currentCombo        = currentCombo.Punch();
         readyForAttackInput = false;
     }
 }
 private void StandingRangedAttack()
 {
     if (readyForAttackInput)
     {
         currentCombo        = currentCombo.RangedAttack();
         readyForAttackInput = false;
     }
 }
Beispiel #12
0
 public void StartAttack(ComboState attack)
 {
     //StartComboAttacks();
     animator.applyRootMotion = true;
     animator.SetBool(attack.ToString(), true);
     //animator.SetBool("Attack", true);
     //animator.SetBool("Attack 1", true);
 }
 public void Taunt()
 {
     if (readyForAttackInput)
     {
         anim.Play("Taunt");
         currentCombo        = currentCombo.GetEndComboState();
         readyForAttackInput = false;
     }
 }
    public override void Awake()
    {
        // Debug.Log("AttackState");
        _anim.Walk(false);

        current_Combo_Timer = default_Combo_Timer;
        current_Combo_State = ComboState.NONE;
        _anim.Punch_1();
    }
Beispiel #15
0
 private void Fortress()
 {
     p1Thruster.ResetNitro(); p2Thruster.ResetNitro();
     p1Shield.Reset(); p2Shield.Reset();
     p1BigShield.gameObject.SetActive(true); p1BigShield.timeToSelfDisable = 2f;
     p2BigShield.gameObject.SetActive(true); p2BigShield.timeToSelfDisable = 2f;
     timer = 2f;
     State = ComboState.Fortress;
 }
Beispiel #16
0
 private void BulletSpin(bool clockwise)
 {
     p1Thruster.ResetNitro(); p2Thruster.ResetNitro();
     p1Gun.cooldown = 0; p2Gun.cooldown = 0;
     p1Shield.Reset(); p2Shield.Reset();
     rigidbody.angularVelocity = clockwise ? 540 : -540;
     rigidbody.angularDrag     = 0;
     timer = 2f;
     State = clockwise ? ComboState.BulletSpinClock : ComboState.BulletSpinAntiC;
 }
Beispiel #17
0
    void ComboAttacks()
    {
        if (CrossPlatformInputManager.GetButtonDown(Button.FIRE_1))
        {
            if (current_Combo_State == ComboState.KICK_2 || isShooting)
            {
                return;
            }


            current_Combo_State++;
            activateTimerToReset = true;
            current_Combo_Timer  = default_Combo_Timer;


            if (current_Combo_State == ComboState.PUNCH_3)
            {
                current_Combo_State = ComboState.KICK_2;
            }

            if (current_Combo_State == ComboState.PUNCH_1)
            {
                player_Anim.Punch_1();
            }

            if (current_Combo_State == ComboState.PUNCH_2)
            {
                player_Anim.Punch_2();
            }

            if (current_Combo_State == ComboState.KICK_2)
            {
                player_Anim.Kick_2();
            }
        }


        if (CrossPlatformInputManager.GetButtonDown(Button.FIRE_2))
        {
            if (current_Combo_State == ComboState.KICK_2 || isShooting)
            {
                return;
            }


            current_Combo_State = ComboState.SHOOT;

            isShooting = true;

            activateTimerToReset = true;
            current_Combo_Timer  = default_Combo_Timer;

            player_Anim.Shoot();
        }
    }
 public void ResetCombo()
 {
     currentCombo            = GetDefaultState();
     readyForAttackInput     = true;
     readyForAttackAnimation = true;
     queuedAttack            = false;
     queuedAttackAnimation   = "";
     queuedAttackDamage      = 0;
     queuedAttackType        = AttackType.Flinch;
     queuedAttackSpecial     = 0;
 }
Beispiel #19
0
 private void ShipOfTheLine()
 {
     p1Thruster.ResetNitro(); p2Thruster.ResetNitro();
     p1Gun.cooldown = 0; p2Gun.cooldown = 0;
     p1Shield.Reset(); p2Shield.Reset();
     rigidbody.drag            = 0;
     rigidbody.velocity        = transform.up * 5f;
     rigidbody.angularVelocity = 0;
     timer = 1.5f;
     State = ComboState.ShipOfTheLine;
 }
Beispiel #20
0
 private void ShieldStrike()
 {
     p1Thruster.ResetNitro(); p2Thruster.ResetNitro();
     rigidbody.drag                     = savedDrag * 10;
     rigidbody.velocity                 = transform.up * 50f;
     rigidbody.angularVelocity          = 0;
     shieldBashDamage.timeToSelfDisable = 1f;
     shieldBashDamage.gameObject.SetActive(true);
     timer = 1f;
     State = ComboState.ShieldStrike;
 }
 public void SpecialAttack()
 {
     if (readyForAttackInput)
     {
         currentCombo = currentCombo.SpecialAttack();
         if (currentCombo != GetDefaultState())  //Check for failed default special attack to prevent not being able to attack
         {
             readyForAttackInput = false;
         }
     }
 }
Beispiel #22
0
 void resetCombostate()
 {
     if (activateTimertoAttack)
     {
         current_Combo_timer -= Time.deltaTime;
         if (current_Combo_timer <= 0)
         {
             current_Combo_state = ComboState.NONE;
         }
     }
 }
    void Attacks()
    {
        if (Input.GetKeyDown(KeyCode.Z))
        {
            if (current_Combo_State == ComboState.PUNCH3 || current_Combo_State == ComboState.KICK1 || current_Combo_State == ComboState.KICK2)
            {
                return;
            }
            current_Combo_State++;
            activateTimerToReset = true;
            current_Combo_Timer  = default_combo_timer;
            if (current_Combo_State == ComboState.PUNCH1)
            {
                animations.Punch_1_Anim();
            }
            if (current_Combo_State == ComboState.PUNCH2)
            {
                animations.Punch_2_Anim();
            }

            if (current_Combo_State == ComboState.PUNCH3)
            {
                animations.Punch_3_Anim();
            }
        }

        if (Input.GetKeyDown(KeyCode.X))
        {
            if (current_Combo_State == ComboState.KICK2 || current_Combo_State == ComboState.PUNCH3)
            {
                return;
            }

            if (current_Combo_State == ComboState.NONE || current_Combo_State == ComboState.PUNCH1 || current_Combo_State == ComboState.PUNCH2)
            {
                current_Combo_State = ComboState.KICK1;
            }
            else if (current_Combo_State == ComboState.KICK1)
            {
                current_Combo_State++;
            }
            activateTimerToReset = true;
            current_Combo_Timer  = default_combo_timer;

            if (current_Combo_State == ComboState.KICK1)
            {
                animations.Kick_1_Anim();
            }
            if (current_Combo_State == ComboState.KICK2)
            {
                animations.Kick_2_Anim();
            }
        }
    }
Beispiel #24
0
 private void Start()
 {
     State     = ComboState.None; // should be using singleton here but i'm a lazy ass
     rigidbody = transform.GetComponent <Rigidbody2D>();
     if (rigidbody == null)
     {
         Debug.LogWarning(gameObject.name + " does not have a rigidbody, self-deleting");
         Destroy(this);
     }
     savedDrag        = rigidbody.drag;
     savedAngularDrag = rigidbody.angularDrag;
 }
 void ResettingComboStates()
 {
     if (activateTimerToReset)
     {
         current_Combo_Timer = current_Combo_Timer - Time.deltaTime;
     }
     if (current_Combo_Timer <= 0f)
     {
         current_Combo_State  = ComboState.NONE;
         activateTimerToReset = false;
     }
 }
Beispiel #26
0
 void ResetComboState()
 {
     if (activateTimerToReset)
     {
         currentComboTimer -= Time.deltaTime;
         if (currentComboTimer <= 0f)
         {
             currentComboState    = ComboState.NONE;
             activateTimerToReset = false;
             currentComboTimer    = defaultComboTimer;
         }
     }
 }
Beispiel #27
0
 private void SwordAndBoard(bool player2side)
 {
     p1Thruster.ResetNitro(); p2Thruster.ResetNitro();
     if (player2side)
     {
         p1BigShield.gameObject.SetActive(true); p1BigShield.timeToSelfDisable = 5f;
     }
     else
     {
         p2BigShield.gameObject.SetActive(true); p2BigShield.timeToSelfDisable = 5f;
     }
     timer = 5f;
     State = player2side? ComboState.SwordAndBoardP2 : ComboState.SwordAndBoardP1;
 }
Beispiel #28
0
    // Start is called before the first frame update
    void Start()
    {   //Combo system!
        current_Combo_Timer = default_Combo_Timer;
        current_Combo_State = ComboState.NONE;


        playerSpriteRenderer = this.GetComponent <SpriteRenderer>();
        gotSpeed             = 0;
        facingRight          = true;
        isAttacking          = false;

        keyDown    = false;
        keyWasDown = false;
    }
    void ResetComboState()                                      //Resets combostate
    {
        if (activateTimerToReset)
        {
            current_Combo_Timer -= Time.deltaTime;

            if (current_Combo_Timer <= 0f)
            {
                current_Combo_State  = ComboState.NONE;
                activateTimerToReset = false;
                current_Combo_Timer  = default_Combo_Timer;
            }
        }
    }
Beispiel #30
0
    private void ResetComboState()
    {
        if (activeTimer)
        {
            comboTimer -= Time.deltaTime;

            if (comboTimer <= 0.0f)
            {
                comboState  = ComboState.NONE;
                comboTimer  = defaultTimer;
                activeTimer = false;
            }
        }
    }