void Update() { if (state == null) { SwitchState(new States.Regular()); // go to regular state when no other state is assigned } if (state != null) { SwitchState(state.Update()); // run the update method } if (HeavyShotTimer > 0) { HeavyShotTimer -= Time.deltaTime; // amount of bullets it should fire } }
// Update is called once per frame void Update() { if (attackTarget != null) { nav.SetDestination(attackTarget.position); } if (state == null) { SwitchState(new States.Idle()); } if (state != null) { SwitchState(state.Update()); } }
void Update() { if (state == null) { SwitchState(new States.Idle(timeToStopIdle)); } //if (state == null) state = if (state != null) { SwitchState(state.Update()); } print(state); }
void Update() { if (attackTarget != null) { nav.SetDestination(attackTarget.position); // If there is a target, get target position } if (state == null) { SwitchState(new States.Idle()); // If no target, become idle } if (state != null) { SwitchState(state.Update()); } }
private void Update() { // If state doesn't exist, set it up. if (state == null) { SwitchState(new States.Regular()); } // Call state.update, if it returns a state, switch to the returned state. if (state != null) { SwitchState(state.Update()); } DamageCooldown(); }
/// <summary> /// Determines when to switch the scene or just update it. /// </summary> private void StateManagement() { if (state == null) { SwitchState(new States.Introduction()); } if (state != null) { if (state != null) { SwitchState(state.Update()); } } ; }
void Update() { if (timerSpawnBullet > 0) { timerSpawnBullet -= Time.deltaTime; } if (state == null) { SwitchState(new States.Regular()); } // call state.update() // switch to the returned state if (state != null) { SwitchState(state.Update()); } }
void Update() { // if nothing is assigned to the state, then make the state go to the Regular() state if (state == null) { SwitchingStates(new States.Idle()); } if (state != null) { SwitchingStates(state.Update()); // makes the state run it's update method } if (dashTimeToUseAgain > 0) { dashTimeToUseAgain -= Time.deltaTime; // Timer to be able to use dash again } }
/// <summary> /// Update is called every game tick /// </summary> void Update() { // If we are not in a state, use the Idle state if (state == null) { SwitchState(new States.Idle()); } // If we are in a state, look for the switch condition in the current state's update if (state != null) { SwitchState(state.Update()); } // Pass the result of the canseeplayer function into a boolean. canSeePlayer = CanSeePlayer(); }
void Update() { if (state == null) { SwitchState(new States.Idle()); } //if (state == null) state = if (state != null) { SwitchState(state.Update()); } if (CanSeeThing(attackTarget)) { MoveTowardTarget(); } }
void Update() { if (timerSpawnBullet > 0) { timerSpawnBullet -= Time.deltaTime; } if (state == null) { SwitchState(new States.Regular()); // go to regular state when no other state is assigned } //call state.update //switch to the returned state if (state != null) { SwitchState(state.Update()); } }
// Update is called once per frame void Update() { if (state == null) { SwitchState(new States.Regular()); } if (state != null) { if (state != null) { SwitchState(state.Update()); } } ; //if (timerSpawnBullt <= 0) }
void Start() { if (GetComponent <NavMeshAgent>() != null) { myNavMeshAgent = GetComponent <NavMeshAgent>(); } myTransform = transform; wanderCheckRate = Random.Range(.01f, .2f); if (state == null) { SwitchState(new States.Wander()); } if (state != null) { SwitchState(state.Update()); } }
void Update() { if (bulletCooldown > 0) { bulletCooldown -= Time.deltaTime; } // If state doesn't exist, set it up. if (state == null) { SwitchState(new States.Regular()); } // Call state.update, if it returns a state, switch to the returned state. if (state != null) { SwitchState(state.Update()); } }
// Update is called once per frame void Update() { print(myTarget); if (health >= 100) { health = 100; } healthSystem = health; ManaRegen(); if (manaRegenTimer >= 0) { manaRegenTimer -= Time.deltaTime; } if (healingSpellCooldown >= 0) { healingSpellCooldown -= Time.deltaTime; } if (attackCooldown >= 0) { attackCooldown -= Time.deltaTime; } CarryOutDetection(); headCheckRate = Random.Range(.8f, 1.2f); if (headTransform == null) { headTransform = myTransform; } if (state == null) { SwitchState(new States.Idle()); } if (state != null) { SwitchState(state.Update()); } if (myTarget != null) { nav.SetDestination(myTarget.position); } }
private void Update() { // Makes the script not run if boss is dead if (healthAmt.health <= 0) { return; } if (state == null) { SwitchState(new States.Idle()); // go to the idle state when no other state can be assigned } if (state != null) { SwitchState(state.Update()); // run the state update method } if (bulletAmountTime > 0) { bulletAmountTime -= Time.deltaTime; // amount of heavyshots the tank can shoot } }
void Update() { if (timerSpawnBullet > 0) { timerSpawnBullet -= Time.deltaTime; // timer to spawn the bullet } if (rocketTimer > 0) { rocketTimer -= Time.deltaTime; // timer to be able to spawn rocket } //// if nothing is assigned to the state, then make the state go to the Regular() state if (state == null) { SwitchState(new States.Regular()); } // call state.update() // switch to the returned state // makes the state run it's update method if (state != null) { SwitchState(state.Update()); } }