|
Post by jrackley on Jan 4, 2017 6:11:00 GMT
Would anybody know if there is a simple way to add/implement the functionality to be able to call methods at waypoints using the UnityEvents to have npc's do custom animations? Basically it would be same as the Simple Waypoint System asset. www.assetstore.unity3d.com/en/#!/content/2506 I know this is probably easy to implement by someone with better c# experience than I have. Thanks in advance for any suggestions, I feel this would set the Invector Waypoint system on a whole new level!
|
|
|
Post by Chronicman on Jan 4, 2017 6:45:11 GMT
Its not an event and its off the top of my head let me know if you have problems.
First Open v_AIMotor and find the field targetWaypoint line 168 and change this to public. Next open vWaypoint and add this code. using Invector;// top
bool doOnce = true; void OnTriggerEnter(Collider other) { if (other.tag == "Enemy") { if (!other.GetComponent<v_AIController>().targetWaypoint.IsOnWay(other.transform) && doOnce) { other.GetComponent<Animator>().Play("wayPointAnim"); doOnce = false; } } } void OnTriggerExit(Collider other) { if (other.tag == "Enemy") { if (other.GetComponent<v_AIController>().targetWaypoint.IsOnWay(other.transform)) { doOnce = true; } } }
|
|
|
Post by Chronicman on Jan 4, 2017 6:46:40 GMT
If you need a method for using more then one animation I'm sure I could whip something up.
|
|
|
Post by jrackley on Jan 4, 2017 7:09:15 GMT
Thanks Chronicaman! once again you come through,lol! I will give it a shot and let ya know how it worked out.
|
|
|
Post by jrackley on Jan 4, 2017 13:53:14 GMT
Its not an event and its off the top of my head let me know if you have problems. First Open v_AIMotor and find the field targetWaypoint line 168 and change this to public. Next open vWaypoint and add this code. using Invector;// top bool doOnce = true; void OnTriggerEnter(Collider other) { if (other.tag == "Enemy") { if (!other.GetComponent<v_AIController>().targetWaypoint.IsOnWay(other.transform) && doOnce) { other.GetComponent<Animator>().Play("wayPointAnim"); doOnce = false; } } } void OnTriggerExit(Collider other) { if (other.tag == "Enemy") { if (other.GetComponent<v_AIController>().targetWaypoint.IsOnWay(other.transform)) { doOnce = true; } } } Not sure if it is something I am doing wrong or not but can not get that to work, looking into it further though.
|
|
|
Post by Chronicman on Jan 4, 2017 16:08:21 GMT
Do you have a animation in your animator with a name that matches wayPointAnim ?
|
|
|
Post by Chronicman on Jan 4, 2017 17:21:00 GMT
Once I'm finished the ES2 Bridge I'll start looking for a better method for this.
|
|
|
Post by jrackley on Jan 4, 2017 19:54:07 GMT
Do you have a animation in your animator with a name that matches wayPointAnim ? LOL, sorry forgot to mark the sphere collider as trigger, prob shouldn't attempt things when I have not had sleep.
|
|
|
Post by Chronicman on Jan 4, 2017 20:03:46 GMT
So its working now mate ?
|
|
|
Post by jrackley on Jan 5, 2017 17:36:49 GMT
So its working now mate ? Yes it seems to be working good now from what I have tried so far, thanks again!
|
|