// Update is called once per frame
 void FixedUpdate()
 {
     if (realTime.IsTimeOn())
     {
         delayBy -= .1f;
         if (rb.velocity == Vector3.zero)
         {
             rb.velocity = storedVel;
         }
         if (timer >= timeBeforeDeletion)
         {
             GameObject.Destroy(gameObject);
         }
         timer += Time.deltaTime;
     }
     else
     {
         if (rb.velocity != Vector3.zero)
         {
             storedVel = rb.velocity;
         }
         rb.velocity = Vector3.zero;
     }
     if (isHoming)
     {
         gameObject.transform.LookAt(GameObject.FindGameObjectWithTag("Enemies").gameObject.transform);
     }
 }
 void FixedUpdate()
 {
     if (realTime.IsTimeOn())
     {
         timer += Time.deltaTime;
         if (timer > 1000)
         {
             GameObject.Destroy(gameObject);
         }
     }
 }
 // Update is called once per frame
 void FixedUpdate()
 {
     try
     {
         if (!realTime.IsTimeOn())
         {
             //stopLoc = gameObject.transform.position;
             agent.isStopped      = true;
             agent.updatePosition = false;
             //justRestarted = true;
             agent.enabled = false;
         }
         else
         {
             if (!isStoppedExternally)
             {
                 agent.enabled = true;
                 //stopLoc = gameObject.transform.position;
                 agent.isStopped      = false;
                 agent.updatePosition = true;
                 //justRestarted = true;
             }
             else
             {
                 //if (justRestarted)
                 //{
                 //  gameObject.transform.position = stopLoc;
                 //}
                 agent.isStopped      = true;
                 agent.updatePosition = false;
                 agent.enabled        = false;
             }
         }
     }catch (Exception e)
     {
         bugLog += e;
     }
     if (agent.updatePosition && realTime.IsTimeOn())
     {
         try
         {
             agent.SetDestination(player.position);
         }
         catch (Exception e)
         {
             bugLog += e;
         }
     }
     //if (!agent.updatePosition) agent.isStopped = true;
 }
Exemplo n.º 4
0
    void FixedUpdate()
    {
        if (realTime.IsTimeOn())
        {
            timer += Time.deltaTime;
            if (inRange && timer > timeBetweenAttk)
            {
                timer = 0;
                int randy = Random.Range(0, 3);
                //Debug.Log (randy);
                switch (randy)
                {
                case 0:
                    playerHealth.TakeDamage(dmgPerAttk);
                    break;

                case 1:
                    plyrMov.stunned = true;
                    playerHealth.TakeDamage(dmgPerAttk / 2);
                    break;

                case 2:
                    plyrRB.AddRelativeForce(0, 2000, 0);
                    playerHealth.TakeDamage(dmgPerAttk);
                    break;

                default:
                    break;
                }
            }
        }
    }
Exemplo n.º 5
0
 // Use this for initialization
 void Start()
 {
     spellMan  = gameObject.GetComponent <SpellManager>();
     realTime  = GameObject.FindGameObjectWithTag("Player").GetComponent <ArtificialTimeManager>();
     timeOn    = realTime.IsTimeOn();
     timeAlive = (int)gameObject.GetComponent <attackLibrary>().GetSavedValues()[0];
 }
Exemplo n.º 6
0
 void FixedUpdate()
 {
     if (realTime.IsTimeOn())
     {
         //timer += Time.deltaTime;
         //if (inRange && timer > timeBetweenAttk && !playerHealth.GetBlocking())
         //{
         //timer = 0;
         //playerHealth.TakeDamage(dmgPerAttk);
         //}
         RaycastHit hit;
         if (Physics.Raycast(gameObject.transform.position, GetRelativeVector(gameObject.transform.position, GameObject.FindGameObjectWithTag("Player").transform.position), out hit, range))
         {
             if (hit.collider.tag.Equals("Player") && !startAttack && !isAttacking)
             {
                 startAttack = true;
                 inMyRange   = true;
             }
         }
         else
         {
             inMyRange = false;
         }
         if (startAttack)
         {
             gameObject.GetComponent <EnemyMovement>().SetStopped(true);
             chargeTime  = defChargeTime;
             isAttacking = true;
             startAttack = false;
         }
         if (isAttacking && chargeTime > 0)
         {
             chargeTime -= .1f;
         }
         else if (isAttacking)
         {
             if (inMyRange)
             {
                 playerHealth.TakeDamage(dmgPerAttk);
             }
             isAttacking = false;
             gameObject.GetComponent <EnemyMovement>().SetStopped(false);
         }
     }
 }
 // Update is called once per frame
 void FixedUpdate()
 {
     if (realTime.IsTimeOn())
     {
         currHealth -= timeDamage;
         timeDamage  = 0;
     }
     if (currHealth <= 0)
     {
         isGoingToDie = true;
     }
     if (bleeding)
     {
         currHealth -= bleedDmg;
     }
     if (pSpawn.GetArenaState() == false)
     {
         GameObject.Destroy(this.gameObject);
     }
 }
 void OnTriggerEnter(Collider other)
 {
     if (other.gameObject.tag == "Player" && realTime.IsTimeOn())
     {
         var attackInst = Instantiate(enemyExplosion);
         attackInst.transform.parent        = gameObject.transform;
         attackInst.transform.localPosition = new Vector3(0, 0, 0);
         attackInst.transform.SetParent(null);
         player.transform.GetComponent <Rigidbody> ().AddExplosionForce(750, gameObject.transform.position, 100, 100);
         enSpawn.enemiesInArena--;
         GameObject.Destroy(gameObject);
     }
 }
 void FixedUpdate()
 {
     if (realTime.IsTimeOn())
     {
         if (rb.velocity == Vector3.zero)
         {
             rb.velocity = storedVel;
         }
         if (timer >= gameObject.GetComponent <ProjectileDamageLibrary> ().travelTime)
         {
             GameObject.Destroy(gameObject);
         }
         timer += Time.deltaTime;
     }
     else
     {
         if (rb.velocity != Vector3.zero)
         {
             storedVel = rb.velocity;
         }
         rb.velocity = Vector3.zero;
     }
 }
 // Update is called once per frame
 void FixedUpdate()
 {
     if (realTime.IsTimeOn())
     {
         Vector3 dir = (player.gameObject.transform.position - transform.position).normalized;
         transform.rotation = Quaternion.Slerp(transform.rotation, Quaternion.LookRotation(new Vector3(dir.x, 0, dir.z)), Time.deltaTime * turnSpeed);
         timer       += Time.deltaTime;
         thrallTimer += Time.deltaTime;
         if (timer >= timeBetweenAttk && inRange)
         {
             Instantiate(enemyFirebolt, enFireBoltSpawn.position, enFireBoltSpawn.rotation);
             timer = 0;
         }
         if (thrallTimer >= timeToSpawnThrall)
         {
             Instantiate(thrall, transform.position, transform.rotation);
             thrallTimer = 0;
         }
     }
 }
 void FixedUpdate()
 {
     timer        += Time.deltaTime;
     timeToSpawn  -= (.0005f * enemiesKilled);
     numberToSpawn = enemiesKilled * .125f;
     if (numberToSpawn > 3)
     {
         numberToSpawn = 3;
     }
     if (timeToSpawn < 7.5f)
     {
         timeToSpawn = 7.5f;
     }
     if (timer > timeToSpawn && canSpawn && realTime.IsTimeOn())
     {
         SpawnEnemy();
         Debug.Log("Spawning Enemy!");
         timer = 0;
     }
     if (Input.GetKeyDown(KeyCode.P))
     {
         enemiesKilled++;
     }
 }
Exemplo n.º 12
0
 // Update is called once per frame
 void FixedUpdate()
 {
     if (realTime.IsTimeOn())
     {
         if (rb.velocity == Vector3.zero)
         {
             rb.velocity = currentVel;
         }
         if (timer >= timeBeforeDeletion)
         {
             GameObject.Destroy(this.gameObject);
         }
         timer += Time.deltaTime;
         gameObject.GetComponent <ProjectileDamageLibrary>().travelTime += Time.deltaTime;
     }
     else
     {
         if (rb.velocity != Vector3.zero)
         {
             currentVel = rb.velocity;
         }
         rb.velocity = Vector3.zero;
     }
 }