// Update is called once per frame void Update() { //DASH if (Input.GetButtonDown("Fire2" + player)) { rb.GetComponent <Dash>().input = true; } // Boomerang if (Input.GetButtonDown("Fire3" + player) && !boomerang.fire) // Detects input for boomerang skill { Boomerang(); } //// attack if (Input.GetButtonDown("Fire1" + player)) { attack.Attacking(); } // Jumping if (Input.GetButtonDown("Jump" + player)) // Checks if player jumps { move.Jump(); } // Movement if (moveInput) { move.horizontal = Input.GetAxis("Horizontal" + player); // Gets input for horizontal movement } }
private void Update() { switch (currentState) { case EnemyAIstates.Wander: enemy.isStopped = false; if (!enemy.pathPending && enemy.remainingDistance < 0.5f) { wonder.NextPoint(); } break; case EnemyAIstates.Target: enemy.isStopped = false; enemy.destination = pursuit.Pursuit(); break; case EnemyAIstates.Attack: timer -= Time.deltaTime; if (timer <= 0.0f) { attack.Attacking(); enemy.isStopped = true; // enemy.destination = enemy.transform.position; Debug.Log("In Range: Attacking has initiated"); timer = attackInterval; } break; } SwitchStates(); }
private void Update() { switch (currentState) { case EnemyAIstates.Wander: enemy.destination = wonder.Wandering(); // Debug.Log("Player not seen: returning to wonder"); break; case EnemyAIstates.Target: enemy.destination = pursuit.Pursuit(); // Debug.Log("Out of Range: Target not reachable; Continuing pursuit"); break; case EnemyAIstates.Attack: attack.Attacking(); enemy.destination = transform.position; // Debug.Log("In Range: Attacking has initiated"); break; } SwitchStates(); Debug.DrawLine(enemy.destination, enemy.gameObject.transform.position, Color.blue); }
void Action() { switch (player_status) { case Status.idle: isInvincible = false; rotation.Update(Input_dir); move.Update(Input_dir, isGrounded, isHit_against_theWall); gravity.Update(isGrounded); break; case Status.jumpping: gravity.Update(true); jump.Jumpping(this.transform); move.Update(Input_dir, false, isHit_against_theWall); rotation.Update(Input_dir); if (jump.isjumpping == false) { GetStatus(Status.idle); } break; case Status.guarding: damage.UPFukitobi(isHit_against_theWall); damage.SIDEFukitobi(isHit_against_theWall); if (guard.transitionProperty == Guard.Transition.Guarding) { if (Input_dir.magnitude != 0) { guard.gobj.SetActive(false); step.Start(Input_dir, true); GetStatus(Status.stepping); break; } } guard.Guarding(); gravity.Update(isGrounded); if (guard.isGuarding == false) { GetStatus(Status.idle); } break; case Status.attacking: attack.Attacking(); attack.isGrounded = isGrounded; if (attack.isAttacking == false) { GetStatus(Status.idle); } if (!isGrounded) { move.Update(Input_dir, false, isHit_against_theWall); } break; case Status.stepping: step.Stepping(isHit_against_theWall); isInvincible = step.invincibleProperty > 0 ? true : false; if (!step.isStepping) { GetStatus(Status.idle); } break; case Status.damaged: guard.gobj.SetActive(false); if (damage.Wait()) { if (!isGrounded && Input.anyKeyDown) //受身 { transform.localEulerAngles = new Vector3 (transform.localEulerAngles.x, transform.localEulerAngles.y, 0); wait.Set(30, 0); GetStatus(Status.waiting); } if (isGrounded && damage.UPFukitobi(isHit_against_theWall) && damage.SIDEFukitobi(isHit_against_theWall)) { wait.Set(40, 0); wait.Waiting(); if (wait.Waiting() == true) { transform.localEulerAngles = new Vector3 (transform.localEulerAngles.x, transform.localEulerAngles.y, 0); GetStatus(Status.idle); } } } else { wait.Set(3, 0); wait.Waiting(); if (wait.Waiting() == true) { isInvincible = false; } else { isInvincible = true; } } damage.UPFukitobi(isHit_against_theWall); if (damage.UPFukitobi(isHit_against_theWall)) { gravity.Update(isGrounded); } damage.SIDEFukitobi(isHit_against_theWall); break; case Status.waiting: wait.Waiting(); if (wait.Waiting() == true) { GetStatus(Status.idle); } break; case Status.Down: this.gameObject.SetActive(false); break; } }