void OnTriggerStay(Collider c) { if (c.gameObject.CompareTag("Bot") && botMode == BotMode.Follow) { BotPart botPart = c.GetComponent <BotPart>(); if (botPart != null) { GameObject bot = botPart.GetParentBot(); if (bot != null) { BotMovement botScript = bot.GetComponent <BotMovement>(); if (botScript != null) { BumpBot(botScript); } } } } }
void OnTriggerEnter(Collider c) { if (c.gameObject.CompareTag("Player") && c.attachedRigidbody != null) { //NOTE: inventory script was deleted if more problems arise. This is what we changed //InventoryScript invent = c.attachedRigidbody.gameObject.GetComponent<InventoryScript>(); if (/*invent != null &&*/ botMode == BotMode.Idle) { botMode = BotMode.Follow; anim.SetBool("BootUp", true); BotCollector bc = c.attachedRigidbody.gameObject.GetComponent <BotCollector>(); if (bc != null) { bc.ReceiveBots(1, transform.gameObject); } followTarget = c.attachedRigidbody.transform; //invent.AddBot(); } } else if (c.gameObject.CompareTag("BotPart") && botMode == BotMode.Follow) { BotPart botPart = c.GetComponent <BotPart>(); if (botPart != null) { GameObject bot = botPart.GetParentBot(); if (bot != null) { BotMovement botScript = bot.GetComponent <BotMovement>(); if (botScript != null) { BumpBot(botScript); } } } } }