Beispiel #1
0
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
Beispiel #2
0
 public override void Die()
 {
     if (controller == null)
     {
         controller = GameObject.Find("LocalCreepController").GetComponent <CreepController>();
     }
     controller.RecallCreep(this.creepId);
     //this.gameObject.SetActive(false);
     //this.inUse = false;
 }
Beispiel #3
0
 /// <summary>
 /// Still Fixxing............
 /// </summary>
 public void FollowPlayer()
 {
     if (creep != null && ControlObjectMain.attacking)
     {
         tmpCreep = creep.transform.GetComponent <CreepController> ();
         Vector3 direction = this.transform.position - creep.position;
         direction.y             = 0;
         this.transform.rotation = Quaternion.Slerp(creep.transform.rotation, Quaternion.LookRotation(direction), 0.9f);
         if (direction.magnitude < 2)
         {
             control.CallAttackDigi();
         }
         else
         {
             this.transform.Translate(0, 0, 0.15f);
             control.CallWalkDigi();
         }
     }
     else if (Vector3.Distance(player.position, this.transform.position) > 3)
     {
         Vector3 direction = player.position - this.transform.position;
         direction.y             = 0;
         this.transform.rotation = Quaternion.Slerp(this.transform.rotation, Quaternion.LookRotation(direction), 0.9f);
         if (ControlObjectMain.evo)
         {
             control.CallEvoDigi();
         }
         else if (ControlObjectMain.attacking)
         {
             control.CallAttackDigi();
         }
         else
         {
             this.transform.Translate(0, 0, 0.15f);
             control.CallWalkDigi();
         }
     }
     else
     {
         //Debug.Log(ControlObjectMain.evo);
         if (ControlObjectMain.evo)
         {
             control.CallEvoDigi();
         }
         else if (ControlObjectMain.attacking)
         {
             control.CallAttackDigi();
         }
         else
         {
             control.CallIdleDigi();
         }
     }
 }
Beispiel #4
0
    private void spawnMinion()
    {
        spawnAmount--;
        GameObject      creep           = getCreep();
        CreepController creepController = creep.GetComponent <CreepController>();

        //move to enemy nexus
        creepController.setTarget(target);
        if (color)
        {
            Renderer rend = creep.GetComponent <MeshRenderer>();
            rend.material = customMaterial;
        }
    }
Beispiel #5
0
    void SpawnCreep()
    {
        Vector2 randMousePos = actionCenter.mouse.GetRandomPos();
        Vector3 newSpawnPos  = new Vector3(randMousePos.x, 1.2f, randMousePos.y);

        //Spawn creep away from the player
        while ((newSpawnPos - actionCenter.transform.position).magnitude < 1f)
        {
            randMousePos = actionCenter.mouse.GetRandomPos();
            newSpawnPos  = new Vector3(randMousePos.x, 1.2f, randMousePos.y);
        }
        creep              = Instantiate(creepPrefab, newSpawnPos, Quaternion.identity);
        creepC             = creep.GetComponent <CreepController>();
        actionCenter.creep = creep.transform;
    }