예제 #1
0
 internal void TransferOpinionToTaggable(Taggable taggable)
 {
     if (Opinions.ContainsKey(taggable.name))
     {
         taggable.Opinion = Opinions[taggable.name];
     }
 }
예제 #2
0
        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;
        }
예제 #3
0
    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
    }
예제 #4
0
    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>());
            }
        }
    }
예제 #5
0
    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);
    }
예제 #6
0
 // Use this for initialization
 void Start()
 {
     playerTaggable = GetComponent <Taggable>();
 }