예제 #1
0
 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());
     }
 }
예제 #3
0
        void Update()
        {
            if (state == null)
            {
                SwitchState(new States.Idle(timeToStopIdle));
            }
            //if (state == null) state =

            if (state != null)
            {
                SwitchState(state.Update());
            }

            print(state);
        }
예제 #4
0
 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());
     }
 }
예제 #5
0
        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();
        }
예제 #6
0
        /// <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());
                }
            }
            ;
        }
예제 #7
0
 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());
     }
 }
예제 #8
0
        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
            }
        }
예제 #9
0
        /// <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();
        }
예제 #10
0
        void Update()
        {
            if (state == null)
            {
                SwitchState(new States.Idle());
            }
            //if (state == null) state =

            if (state != null)
            {
                SwitchState(state.Update());
            }

            if (CanSeeThing(attackTarget))
            {
                MoveTowardTarget();
            }
        }
예제 #11
0
        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());
            }
        }
예제 #12
0
        // 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)
        }
예제 #13
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());
            }
        }
예제 #14
0
        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);
            }
        }
예제 #16
0
        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());
            }
        }