Exemplo n.º 1
0
    public void navDestroyEverything(NavWaypointManager n)          //destroyes entire movement command hierarchy and starts from scratch
    {
        n.commandMove.Clicked        -= n.NavPointPlace;
        n.commandMove.RemoveWaypoint -= n.DeSpawn;
        n.commandMove.combatController.SelectEvent -= n.RemoveColliderFromWaypoint;
        CombatController.DeSelectAllEvent          -= n.AddColliderToWaypoint;

        CombatController.DeSelectAllEvent          += n.AddColliderToWaypoint;
        n.commandMove.combatController.SelectEvent += n.RemoveColliderFromWaypoint;

        Destroy(n.lineRenderObject);
        Destroy(this.gameObject);
    }
Exemplo n.º 2
0
    public GameObject spawnLineRenderer(NavWaypointManager n, GameObject target, bool enabledAtStart)            // activates line renderer script on Nav Point
    {
        GameObject l = Object.Instantiate(n.lineRendererPrefab, target.transform.position, Quaternion.identity); //spawn new line renderer

        l.transform.SetParent(this.transform.parent);                                                            // keeps the parent as the source
        l.AddComponent <PathwayActivate>();
        LineRenderer line = l.GetComponent <LineRenderer>();

        line.enabled = enabledAtStart;
        l.SendMessage("SetAgentSource", target);
        Destroy(this);
        return(l);
    }
Exemplo n.º 3
0
    public void Clear(List <GameObject> navPointObjects, GameObject lineRenderObject, NavWaypointManager navWaypointManager) // removes most recent nav points, sets parent of previous one
    {
        Destroy(navPointObjects[navPointObjects.Count - 1]);
        navPointObjects.Remove(navPointObjects[navPointObjects.Count - 1]);

        if (navPointObjects.Count - 1 > -1)                                     // if the list is not empty
        {
            mostRecentNav = navPointObjects[navPointObjects.Count - 1];

            lineRenderObject.SendMessage("SetAgentSource", mostRecentNav);
            lineRenderObject = mostRecentNav;
            navWaypointManager.navPointPrefabSpawned = mostRecentNav;
        }
        else                                                                     // if the list is empty (for some reason)
        {
            lineRenderObject = transform.parent.GetComponentInChildren <PathwayDraw>().gameObject;
            lineRenderObject.SendMessage("SetAgentSource", this.transform.parent.parent.gameObject);
        }
        SendMessage("Subtract");
        Destroy(this);
    }
Exemplo n.º 4
0
 public void OnEnable()
 {
     navWaypoints = GetComponent <NavWaypointManager>();
 }