internal void TransferOpinionToTaggable(Taggable taggable) { if (Opinions.ContainsKey(taggable.name)) { taggable.Opinion = Opinions[taggable.name]; } }
internal void Set(Taggable taggable) { Debug.Log(taggable.PrefabAssetPath); var prefab = AssetDatabase.LoadAssetAtPath <Taggable>(taggable.PrefabAssetPath); prefab.Opinion = taggable.Opinion; //var path = taggable.name.Replace("(Clone)", ""); Opinions[taggable.PrefabAssetPath] = taggable.Opinion; }
public void Tag(Taggable tagger) { print(tagger.gameObject.name + " TAGS " + this.gameObject.name); tagger.isIt = false; // tagger is no longer it tagger.isImmune = true; // tagger gets immunity tagger.immunityTimer = 0f; // reset the timer isIt = true; // become it }
void OnTriggerEnter(Collider other) { print(other.gameObject.name + " Has collided with " + this.gameObject.name); // only do something if you are it if (isIt) { Taggable taggableCol = other.gameObject.GetComponent <Taggable>(); bool notSelf = other.gameObject.name != this.gameObject.name; // If the entering collider is Taggable and not yourself and it isn't immune if (taggableCol != null && notSelf && !taggableCol.isImmune) { taggableCol.Tag(GetComponent <Taggable>()); } } }
void Start() { self = GetComponent <Transform>(); nav = GetComponent <NavMeshAgent> (); animation = GetComponent <Animation>(); taggable = GetComponent <Taggable>(); defaultSpeed = nav.speed; AllHidingSpots = hidingSpots.getHidingSpots; var taggables = GameObject.Find("TagPlayers").GetComponentsInChildren <Taggable>(); var transformsOfTaggables = taggables.Select(t => { return(t.gameObject.transform); }).ToArray(); var removeSelf = transformsOfTaggables.Where(t => { return(t.gameObject != this.gameObject); }); allPlayers = removeSelf.ToArray(); // find a hiding spot right away currentDestination = FindClosestHidingSpot(); nav.SetDestination(currentDestination); }
// Use this for initialization void Start() { playerTaggable = GetComponent <Taggable>(); }