Example #1
0
    public void Start()
    {
        PheromoneNode pn = gameObject.AddComponent <PheromoneNode>();

        pn.InitializeNode(null);
        pn.immortal = true;
    }
Example #2
0
    public PheromoneNode CreateNewNode(PheromoneNode parentNode, GV.PhermoneTypes pherType, Vector2 spawnLocation)
    {
        if (parentNode == null)
        {
            return(RetrieveNewNode(pherType, spawnLocation));
        }
        GameObject     newNodeGO  = Instantiate(phermoneNodePrefab, spawnLocation, Quaternion.identity) as GameObject;
        GameObject     newTrailGO = Instantiate <GameObject>(phermoneTrailPrefab);
        PheromoneNode  newNode    = newNodeGO.GetComponent <PheromoneNode>();
        PheromoneTrail newTrail   = newTrailGO.GetComponent <PheromoneTrail>();

        newTrail.Initialize(parentNode, newNode, pherType);
        parentNode.AddTrail(newTrail);
        parentNode.initialRoot = false;
        newNode.InitializeNode(newTrail);
        pheromoneNodes.Add(newNode);
        pheromoneTrails.Add(newTrail);
        return(newNode);
    }