Example #1
0
 // Start is called before the first frame update
 void Start()
 {
     homePoint = this.transform.position;
     //getting crowded need to think of a way to change -
     //this movement setup for each enemy accordingly
     if (this.gameObject.name.Contains("Slime"))
     {
         slime = GetComponent <SlimeScript>();
     }
     else if (this.gameObject.name.Contains("Golem"))
     {
         golem = GetComponent <GolemScript>();
     }
     else if (this.gameObject.name.Contains("Bull"))
     {
         bull = GetComponent <BullScript>();
     }
     else if (this.gameObject.name.Contains("Blazer"))
     {
         blazer = GetComponent <BlazerScript>();
     }
     player      = GameObject.FindGameObjectWithTag("Player");
     seeker      = GetComponent <Seeker>();
     rb          = GetComponent <Rigidbody2D>();
     isdraggable = GetComponent <Draggable>();
     manager     = GameObject.FindGameObjectWithTag("Manager").GetComponent <GameManager>();
     target      = homePoint;
     InvokeRepeating("UpdatePath", 0f, .05f); //Updates Path every 0.05 seconds
     UpdatePath();
 }
Example #2
0
    //Calls when a trigger collider is overlapped with this collider
    void OnTriggerEnter2D(Collider2D col)
    {
        //assign a slime var to the slime script component of the overlapped object
        SlimeScript slime = col.GetComponent <SlimeScript>();

        //if the overlapped object has a slime script..
        if (slime != null)
        {
            //if arrow is still moving..
            if (rb.velocity != new Vector2(0f, 0f))
            {
                //deal damage to the specific slime that was overlapped
                slime.TakeDmg(damage);
            }
        }
    }
Example #3
0
	// Use this for initialization
	void Start () {
		slimeScript = GetComponent<SlimeScript> ();
		parent = this.transform.parent.gameObject;
	}