Exemplo n.º 1
0
    // Function : Movment
    // Method : This Fuction is use for The Object who named is Player Or Tag is Player which uses for Transform position
    void Movement(float h, float v)
    {
        if (!TalkingWithNPC)
        {
            if (!isPlayerDead || !getHit || !isAttack)
            {
                if ((h != 0 || v != 0) && !isTauntMode && !defendmode)
                {
                    movDir       = new Vector3(h, 0, v);
                    playerstates = PLAYERSTATE.PlayerState_Moving;
                    Rotating(h, v);
                    _rgbd.MovePosition(_rgbd.position + speed * movDir * Time.deltaTime);
                    _anim.SetInteger("Walking", 1);
                    Jumping = false;
                }
                else if (h == 0 || v == 0)
                {
                    _anim.SetInteger("Walking", 0);
                    Jumping      = false;
                    playerstates = PLAYERSTATE.PlasyerState_Ilde;
                }
            }
        }


        if (TalkingWithNPC)
        {
            vertical   = 0f;
            horizontal = 0f;
            _anim.SetInteger("Walking", 0);
        }
    }
 void Slap()
 {
     p1State        = PLAYERSTATE.ATTACK;
     p2Health.isHit = true;
     actionTimer    = 0.0f;
     anim.SetTrigger("Slap");
 }
Exemplo n.º 3
0
 /// <summary>
 /// 敌人已准备
 /// </summary>
 public void Ready()
 {
     enemyState = PLAYERSTATE.WALK;
     playerAnimator.SetAnimatorTrigger("Idle");
     playerAnimator.SetAnimatorFloat("MovementSpeed", 0.5f);
     Move(Vector3.zero, 0f);
 }
Exemplo n.º 4
0
    void OnTriggerExit(Collider col)
    {
        if (col.gameObject.tag == "Enemy")
        {
            //Debug.Log(col.name);
            lookEM.Remove(col.gameObject);
        }

        if (col.gameObject.tag == "Player")
        {
            //Debug.Log(col.name);
            if (lookPL.Count > 0)
            {
                lookPL.RemoveAt(0);
            }
            Playerstate = PLAYERSTATE.IDLE;
            //Playerstate = PLAYERSTATE.FIND;
        }

        //if (col.gameObject.tag == "PlayerRespawn")
        //{
        //    if (Respawns.Count < 1)
        //    {
        //        Debug.Log("dd");
        //        Respawns.Add(col.gameObject);
        //    }
        //}
    }
Exemplo n.º 5
0
    void Start()
    {
        Fwd                = 0;
        playercollider     = GetComponent <CapsuleCollider>();
        ShootAble          = true;
        MeleeAble          = true;
        isGround           = false;
        isLadder           = false;
        JumpFlag           = false;
        FlashActive        = false;
        transform.position = new Vector3(-9.57f, 3.5f, -0.79f);
        MaxSpeed           = 0;
        PlayerState        = PLAYERSTATE.IDLE;
        fov                = 60;
        playerstatus       = GetComponent <PlayerStatus>();
        rigid              = GetComponent <Rigidbody>();
        animator           = GetComponent <Animator>();
        Animator wantedAnim = GetComponentsInChildren <Animator>()[1];

        Destroy(wantedAnim);
        animator.avatar = wantedAnim.avatar;
        clearmng        = GetComponent <ClearMng>();
        audiosource     = GetComponent <AudioSource>();
        if (!isLocalPlayer)
        {
            QuickSlot.SetActive(false);
        }
        else
        {
            CmdSetType(GameData.Instance.PlayerType);
        }
    }
 void Slash()
 {
     p1State = PLAYERSTATE.ATTACK;
     p2Health.isHit = true;
     actionTimer = 0.0f;
     anim.SetTrigger("Slash");
 }
Exemplo n.º 7
0
    // Update is called once per frame
    void Update()
    {
        float gunAngle = GetToMouseAngle(this.transform.position.x, this.transform.position.y);// + 90;

        //float gunAngle = playerToMouseAngle;// + 90;


        Debug.Log(GetToMouseAngle(this.transform.position.x, this.transform.position.y));// + 90);//GetToMouseAngle(this.transform.position.x, this.transform.position.y));

        DefineOfState();
        if (state == PLAYERSTATE.MOVE)
        {
            this.transform.Translate(moveSpeed * Time.deltaTime, 0, 0, Space.Self);
        }
        if (state == PLAYERSTATE.FIRE)
        {
            Vector3 pos;
            pos.x = bulletGap;
            pos.y = 0;
            pos.z = 0;

            //Quaternion.Euler(0, gunAngle, 0)
            Instantiate(Bullet, this.transform.position + pos, Quaternion.Euler(0, 0, gunAngle));//this.transform.rotation);//this.transform.position, this.transform.rotation);
            state = PLAYERSTATE.IDLE;
        }
    }
 void CounterHit()
 {
     p1State = PLAYERSTATE.ATTACK;
     p2Health.isHit = true;
     actionTimer = 0.0f;
     anim.SetTrigger("CounterHit");
 }
Exemplo n.º 9
0
 //Function : Update
 // Method : Use for Update The Player Jump,Atk,Defend
 void Update()
 {
     Jump();
     DefendMode();
     _animStateInfo = _anim.GetCurrentAnimatorStateInfo(0);
     if (Input.GetKeyDown(KeyCode.Space) && CanAttackArea)
     {
         Attack();
         //Debug.Log(BtnHitCount);
         Jumping = false;
         //Debug.Log("AnimStateInfo NormalizeTime" + _animStateInfo.normalizedTime);
     }
     else if
     (Input.GetKeyDown(KeyCode.Space) && isTalkingArea)
     {
         TalkingWithNPC = !TalkingWithNPC;
     }
     if (!_animStateInfo.IsName(IldeAnimString) && _animStateInfo.normalizedTime >= 1.1f)
     {
         _anim.SetInteger("Attack", 0);
         BtnHitCount  = 0;
         Jumping      = false;
         isAttack     = false;
         playerstates = PLAYERSTATE.PlasyerState_Ilde;
     }
 }
    bool BodySnatch()
    {
        if (Physics.Raycast(transform.position, transform.forward, out RaycastHit hit0, snatchDistance))
        {
            if (hit0.transform.tag == "Human")
            {
                state = PLAYERSTATE.NEWBODY;
                if (hostBody != null)
                {
                    if (gunCtrl != null)
                    {
                        gunCtrl.transform.parent = null;

                        Transform hostGunSpot = hostBody.GetGunSpot();
                        gunCtrl.transform.position = hostGunSpot.position;
                        gunCtrl.transform.rotation = Quaternion.Euler(hostGunSpot.eulerAngles.x, hostGunSpot.eulerAngles.y, hostGunSpot.eulerAngles.z);
                        gunCtrl.transform.parent   = hostBody.transform;
                    }
                    //handle letting go of the current snatched body
                    hostBody.Depossess();

                    gunCtrl = null;
                }
                hostBody = hit0.transform.GetComponent <HumanController>();
                return(true);
            }
        }
        return(false);
    }
Exemplo n.º 11
0
    void PlayerMoving(PLAYERSTATE nextState)
    {
        Vector3 prevPos = this.transform.position;
        //キーボード数値取得。プレイヤーの方向として扱う
        float h = ControllerManager.Instance.GetLeftHorizontal();      //横
        float v = ControllerManager.Instance.GetLeftVertical();        //縦

        //カメラのTransformが取得されてれば実行
        if (CamPos != null)
        {
            //2つのベクトルの各成分の乗算(Vector3.Scale)。単位ベクトル化(.normalized)
            Camforward = Vector3.Scale(CamPos.forward, new Vector3(1, 0, 1)).normalized;
            //移動ベクトルをidoというトランスフォームに代入
            ido = v * Camforward * runspeed + h * CamPos.right * runspeed;
            //Debug.Log(ido);
        }

        //現在のポジションにidoのトランスフォームの数値を入れる
        transform.position = new Vector3(
            transform.position.x + ido.x,
            transform.position.y + ido.y,
            transform.position.z + ido.z);

        if (prevPos == transform.position)
        {
            playerStateMachine.SetState(nextState);
        }
    }
    /* Purpose: 플레이어(캐릭터)의 상태를 체크 / 처리하는 함수.
     * Variable: X
     * Notice: 
     */
    private void Do_CheckPlayerState()
    {
        switch (m_playerState)
        {
            case PLAYERSTATE.Idle:
                break;

            case PLAYERSTATE.Run:
                m_mainCharacter.Do_Particle("Run", true);
                m_mainCharacter.Do_Particle("Landing", false);
                break;

            case PLAYERSTATE.Jump:
                m_mainCharacter.Do_Particle("Run", false);
                m_mainCharacter.Do_Particle("Jump", true);
                m_mainCharacter.Do_Particle("Landing", true);
                break;

            case PLAYERSTATE.Landing:
                m_mainCharacter.Do_Particle("Jump", false);
                m_mainCharacter.Do_Particle("Landing", false);
                m_mainCharacter.Do_Particle("Landing", true);

                m_playerState = PLAYERSTATE.Run;
                break;

            case PLAYERSTATE.Slide:
                break;

            case PLAYERSTATE.Dead:
                break;
        }
    }
Exemplo n.º 13
0
    private void Start()
    {
        getValuesFromProps();

        playerState  = PLAYERSTATE.Idle;
        platesHolder = transform.GetChild(0).Find("Plates Holder");
    }
Exemplo n.º 14
0
    private void Update()
    {
        havePlates = plates.Count > 0 ? true : false;

        if (GameManager.gameState == GameState.InGame && playerState != PLAYERSTATE.Dodged && joyStick.minDisMoved(minInputDistance))
        {
            if (plates.Count != 0)
            {
                playerState = PLAYERSTATE.CarryRun;
            }
            else
            {
                playerState = PLAYERSTATE.Run;
            }

            transform.rotation = Quaternion.Euler(Vector3.up * Joystick.angle);
        }
        else if (playerState != PLAYERSTATE.Dodged)
        {
            if (plates.Count != 0)
            {
                playerState = PLAYERSTATE.CarryIdle;
            }
            else
            {
                playerState = PLAYERSTATE.Idle;
            }
        }
    }
 void CounterHit()
 {
     p1State        = PLAYERSTATE.ATTACK;
     p2Health.isHit = true;
     actionTimer    = 0.0f;
     anim.SetTrigger("CounterHit");
 }
Exemplo n.º 16
0
 //Name  :Movment
 // This Function mainly is use for Get Movement Function
 void Movement(float h, float v)
 {
     if ((h != 0 || v != 0))
     {
         movDir = new Vector3(h, 0, v);
         Rotating(h, v);
         _rgbd.MovePosition(_rgbd.position + speed * movDir * Time.fixedDeltaTime);
         _anim.SetBool("isMoving", true);
         playerstatement = PLAYERSTATE.PlayerState_MovingWalk;
     }
     if (Input.GetKey(KeyCode.LeftShift))
     {
         spd += Time.deltaTime;
     }
     else
     {
         spd -= Time.deltaTime;
     }
     spd = Mathf.Clamp(spd, 0f, 1f);
     _anim.SetFloat("Speed", spd);
     if (spd == 1)
     {
         playerstatement = PLAYERSTATE.PlayerState_MovingRun;
     }
     if (playerstatement == PLAYERSTATE.PlayerState_MovingRun)
     {
         speed = 9f;
     }
     else if (playerstatement == PLAYERSTATE.PlayerState_MovingWalk)
     {
         speed = 7f;
     }
 }
Exemplo n.º 17
0
 // Name :  FixedUpdate
 // Method : This Function Mainly is used for Movement
 void FixedUpdate()
 {
     if (CanMov)
     {
         vertical   = Input.GetAxisRaw("Vertical");
         horizontal = Input.GetAxisRaw("Horizontal");
         if (!Dead)
         {
             if (!isStunnedMode)
             {
                 if (!isattack)
                 {
                     if ((vertical != 0 || horizontal != 0))
                     {
                         Movement(horizontal, vertical);
                     }
                     else if ((vertical == 0 || horizontal == 0))
                     {
                         _anim.SetBool("isMoving", false);
                         playerstatement = PLAYERSTATE.PlayerState_Ilde;
                     }
                 }
             }
         }
     }
 }
Exemplo n.º 18
0
    void UpdateJumpState()
    {
        // jump sound
        if (currentCharacter.currentPlayer.CompareTag("AgileRobot") && gridManager.GetComponent <PauseUnPause>().paused == false)
        {
            mandySound.volume = mandyJumpingVolume;
            mandySound.clip   = jumpingMandy;
        }


        lerpMoveTime += Time.deltaTime * moveSpeed;

        center        = (startLerpPos + target) * 0.5f;
        center       -= new Vector3(0, 1, 0);
        startSlerpPos = startLerpPos - center;
        endSlerpPos   = target - center;

        transform.position  = Vector3.Slerp(startSlerpPos, endSlerpPos, lerpMoveTime);
        transform.position += center;

        mandyAnim.SetBool("mandyJump", true);
        if (lerpMoveTime >= 1.0f)
        {
            currentIndex = gridManager.PosToIndex(transform.position);
            lerpMoveTime = 0.0f;
            mandyAnim.SetBool("mandyJump", false);
            playerState = PLAYERSTATE.IDLE;
        }
    }
Exemplo n.º 19
0
 /// <summary>
 /// 防御
 /// </summary>
 private void Defend()
 {
     enemyState = PLAYERSTATE.DEFEND;
     playerAnimator.ShowDefendEffect();
     playerAnimator.SetAnimatorTrigger("Defend");
     GlobalAudioPlayer.PlaySFX("DefendHit");
     playerAnimator.SetDirection(currentDirection);
 }
Exemplo n.º 20
0
 // Basic Setting Of The Infomartion
 void BasicSetting()
 {
     playerstatement = PLAYERSTATE.PlayerState_Ilde;
     BtnHitCount     = 0;
     HasntPlayBefore = false;
     isStunnedMode   = false;
     CanMov          = true;
 }
Exemplo n.º 21
0
    private void SetPlayerState(PLAYERSTATE newState)
    {
        if (playerState != newState)
        {
            playerState = newState;
        }

        SetAnimations();
    }
Exemplo n.º 22
0
 public void FindEne()
 {
     Enemyf.Clear();
     Enemyf.AddRange(GameObject.FindGameObjectsWithTag("Enemy"));
     if (Enemyf.Count < 1)
     {
         Playerstate = PLAYERSTATE.FINISH;
     }
 }
Exemplo n.º 23
0
    // Use this for initialization
    void Start()
    {
        // Current State
        playerState = PLAYERSTATE.VUNERABLE;

        // Game Objects
        wallsOfDoom = GameObject.FindGameObjectsWithTag("Wall");
        boss        = GameObject.FindWithTag("Boss");
    }
Exemplo n.º 24
0
 // Use this for initialization
 void Start()
 {
     playerState = PLAYERSTATE.gunIdle;
     gameObject.GetComponent <Binoculars>().enabled = false;
     gameObject.GetComponent <Zoom>().enabled       = false;
     player         = GetComponent <CharacterController>();
     playerAnimator = GetComponent <Animator>();
     playerAnimator.SetBool("isJump", false);
     playerAnimator.SetBool("isRun", false);
 }
Exemplo n.º 25
0
 private void HandleDodgeInput()
 {
     if (Input.GetKeyDown(KeyCode.UpArrow))
     {
         if (border.isCorrect())
         {
             staff.addBeat(BEAT.UP);
             state       = PLAYERSTATE.DODGING;
             rb.velocity = new Vector2(0, dodgeSpeed);
             GameObject.Instantiate(movePS, new Vector3(this.transform.position.x, this.transform.position.y + 2.5f, 0), Quaternion.identity, this.transform);
             speedMultiplier = 2;
             animator.SetBool("running", true);
             HandleDirection();
         }
     }
     else if (Input.GetKeyDown(KeyCode.LeftArrow))
     {
         if (border.isCorrect())
         {
             staff.addBeat(BEAT.LEFT);
             state       = PLAYERSTATE.DODGING;
             rb.velocity = new Vector2(-dodgeSpeed, 0);
             GameObject.Instantiate(movePS, new Vector3(this.transform.position.x - 2.5f, this.transform.position.y, 0), Quaternion.identity, this.transform);
             speedMultiplier = 2;
             animator.SetBool("running", true);
             HandleDirection();
         }
     }
     else if (Input.GetKeyDown(KeyCode.RightArrow))
     {
         if (border.isCorrect())
         {
             staff.addBeat(BEAT.RIGHT);
             state           = PLAYERSTATE.DODGING;
             rb.velocity     = new Vector2(dodgeSpeed, 0);
             speedMultiplier = 2;
             animator.SetBool("running", true);
             HandleDirection();
             GameObject.Instantiate(movePS, new Vector3(this.transform.position.x + 2.5f, this.transform.position.y, 0), Quaternion.identity, this.transform);
         }
     }
     else if (Input.GetKeyDown(KeyCode.DownArrow))
     {
         if (border.isCorrect())
         {
             staff.addBeat(BEAT.DOWN);
             state           = PLAYERSTATE.DODGING;
             rb.velocity     = new Vector2(0, -dodgeSpeed);
             speedMultiplier = 2;
             animator.SetBool("running", true);
             HandleDirection();
             GameObject.Instantiate(movePS, new Vector3(this.transform.position.x, this.transform.position.y - 2.5f, 0), Quaternion.identity, this.transform);
         }
     }
 }
Exemplo n.º 26
0
 /// <summary>
 /// 设置玩家状态
 /// </summary>
 /// <param name="state"></param>
 public void SetPlayerState(PLAYERSTATE state)
 {
     if (playerState != null)
     {
         playerState.SetState(state);
     }
     else
     {
         Debug.Log("playerState not found on this gameObject");
     }
 }
Exemplo n.º 27
0
 private void OnCollisionEnter2D(Collision2D collision)
 {
     if (collision.gameObject.CompareTag("ground"))
     {
         collisionGround = true;
         if (state == PLAYERSTATE.JUMP)
         {
             state = PLAYERSTATE.IDLE;
         }
     }
 }
Exemplo n.º 28
0
 //Function : Start Function
 // Method : Mainly use For Setting Crt State
 void Start()
 {
     GetComponentFunction();
     BtnHitCount  = 0;
     Jumping      = false;
     playerstates = PLAYERSTATE.PlasyerState_Ilde;
     defendmode   = false;
     isTauntMode  = false;
     isPlayerDead = false;
     getHit       = false;
 }
    void Start()
    {
        state        = PLAYERSTATE.START;
        vehicleCtrl  = FindObjectOfType <VehicleController>();
        movementCtrl = GetComponent <MovementController>();

        startCounter       = startTimer;
        transform.rotation = Quaternion.Euler(0, 0, 0);

        overlayCtrl = FindObjectOfType <OverlayController>();
    }
Exemplo n.º 30
0
    // Use this for initialization
    void Start()
    {
        playerState      = PLAYERSTATE.IDLE;
        gridManager      = GameObject.FindWithTag("Game Overseer").GetComponent <GridManager>();
        currentIndex     = gridManager.PosToIndex(this.transform.position);
        currentCharacter = gridManager.GetComponent <SwapCharacter>();

        billySound = GameObject.FindWithTag("ShieldRobot").GetComponent <AudioSource>();
        mandySound = GameObject.FindWithTag("AgileRobot").GetComponent <AudioSource>();

        mandy = GameObject.FindWithTag("AgileRobot");
    }
 //////////////////////////////////////////////////////////////////////////////////////////
 void Defend()
 {
     if (Input.GetButton("X_button2"))
     {
         p2State = PLAYERSTATE.DEFEND;
         actionTimer = 0.0f;
         anim.SetBool("Defend", true);
     }
     else {
         p2State = PLAYERSTATE.IDLE;
     }
 }
Exemplo n.º 32
0
    // Use this for initialization
    void Start()
    {
        npcLayerMask    = LayerMask.NameToLayer("NPC");
        playerLayerMask = LayerMask.NameToLayer("Player");
        attackLayerMask = LayerMask.NameToLayer("Attack");
        d     = new DamageObject(20, AttackType.KnockDown, PowerType.Medium, this.gameObject.transform.parent.gameObject, 1f, Vector3.down, 0.005f, 10f);
        d.lag = 0f;

        verticalVelocity = 12;
        moveVectorX      = 2;
        state            = PLAYERSTATE.SHENGLONGBA;
    }
        private void Update()
        {
            float h = CrossPlatformInputManager.GetAxis("Horizontal");
            //float v = CrossPlatformInputManager.GetAxis("Vertical");
            if (m_Character.m_Grounded) //set player to moving state if grounded
                playerState = PLAYERSTATE.MOVING;

            if (m_Character.m_Walled && !m_Character.m_Grounded && !m_wallBehaviour.hasWallStuck) //using states to control wallbehaviour, gives more control
                playerState = PLAYERSTATE.WALLSLIDING;                                            //because of the friction parameter making player sticks to
                                                                                                  //walls if holding the direction of the wall

            if (playerState == PLAYERSTATE.WALLSLIDING && Input.GetKeyDown(KeyCode.Space))      //if the player is holding the oposite direction to the wall
            {                                                                                   //the walljumps in the oposite direction
                print("Jump was pressed");
                playerState = PLAYERSTATE.MOVING;
                m_wallBehaviour.WallJump(h);
            }

            if (!m_Jump)
            {

                // Read the jump input in Update so button presses aren't missed.
                m_Jump = CrossPlatformInputManager.GetButtonDown("Jump");
            }

            if (playerState == PLAYERSTATE.MOVING && Input.GetButtonDown("Fire2"))
            {
                m_Character.Shoot();
            }

            if (playerState == PLAYERSTATE.WALLSLIDING && Input.GetButtonDown("Fire2")) //shoots in the oposite direction if on a wall
            {
                m_Character.WallShoot();
            }

            //sets the direction of attacks depending on player state and button pressed
            if (playerState == PLAYERSTATE.MOVING && Input.GetButtonDown("Fire1") &&
                hasStandardSwordAttacke == false && !Input.GetKey(KeyCode.W) && !Input.GetKey(KeyCode.S)
                && (Input.GetKey(KeyCode.A) || Input.GetKey(KeyCode.D) || h <= 1))
            {
                m_swordAttack.StandardSwordAttack();
            }
            if (playerState == PLAYERSTATE.MOVING && Input.GetButtonDown("Fire1") &&
                hasStandardSwordAttackedAbove == false && Input.GetKey(KeyCode.W))
            {
                m_swordAttack.SwordAttackAbove();
            }
            if (playerState == PLAYERSTATE.MOVING && Input.GetButtonDown("Fire1") && Input.GetKey(KeyCode.S) && !m_Character.m_Grounded)
            {
                m_swordAttack.SwordAttackBelow();
            }
        }
Exemplo n.º 34
0
 // Function :Jumping
 // Method : Using For Player Jump
 void Jump()
 {
     if (!isPlayerDead || !getHit)
     {
         if (Input.GetKeyDown(KeyCode.J) && isGrounded() && _animStateInfo.IsName(IldeAnimString))
         {
             _rgbd.velocity = new Vector3(0, jumpPower * Time.deltaTime, 0f);
             Jumping        = true;
             playerstates   = PLAYERSTATE.PlayerState_Jumping;
             _anim.SetTrigger("Jump");
         }
     }
 }
Exemplo n.º 35
0
 void SetState(PLAYERSTATE st)
 {
     state = st;
     switch (state) {
     case PLAYERSTATE.Run:
         animator.SetBool("Jump",false);
         break;
     case PLAYERSTATE.Jump:
         animator.SetBool("Jump",true);
         break;
     case PLAYERSTATE.Jump2:
         animator.SetBool("Jump2",true);
         rigidbody2d.velocity = Vector2.zero;
         rigidbody2d.AddForce(Vector2.up * jumpPower);
         break;
     case PLAYERSTATE.Die:
         break;
     }
 }
Exemplo n.º 36
0
 public void SetState(PLAYERSTATE st)
 {
     state = st;
     switch (state) {
     case PLAYERSTATE.RUN:
         anim.SetBool("Jump",false);
         break;
     case PLAYERSTATE.JUMP:
         anim.SetBool("Jump",true);
         rBody2D.AddForce(Vector2.up * jumpPower);
         break;
     case PLAYERSTATE.SECONDJUMP:
         anim.SetBool("SJump",true);
         rBody2D.AddForce(Vector2.up * jumpPower);
         rBody2D.velocity = Vector2.zero;
         break;
     case PLAYERSTATE.DIE:
         rBody2D.isKinematic = true;
         break;
     }
 }
Exemplo n.º 37
0
 void Jump()
 {
     if(state == PLAYERSTATE.GROUND)
     {
         GetComponent<Rigidbody2D>().AddForce(new Vector2(0, jumpForce));
         state = PLAYERSTATE.AIR;
     }
 }
    // Update is called once per frame
    void Update()
    {
        if (playerHealth.IsPlayerAlive())
        {
            actionTimer += Time.deltaTime;
            anim.SetBool("Defend", false);

            if (Input.GetButton("X_button"))
            {
                Defend();

            }
            else {
                p1State = PLAYERSTATE.IDLE;
            }

            if (Input.GetButton("A_button") && (actionTimer >= timeBetweenAction))
            {
                CounterHit();
            }
            else if (Input.GetButton("B_button") && (actionTimer >= timeBetweenAction))
            {
                Slap();
            }
            else if (Input.GetButton("Y_button") && (actionTimer >= timeBetweenAction))
            {
                Slash();
            }

            if (Input.GetButton("Taunt") && (actionTimer >= timeBetweenAction))
            {
                Taunt();
                return;
            }

        }
    }
Exemplo n.º 39
0
 void OnCollisionEnter2D(Collision2D hit)
 {
     if(hit.gameObject.tag == "Ground")
     {
         state = PLAYERSTATE.GROUND;
     }
 }
 //////////////////////////////////////////////////////////////////////////////////////////
 void Defend()
 {
     p1State = PLAYERSTATE.DEFEND;
     actionTimer = 0.0f;
     anim.SetBool("Defend", true);
 }