void Start()
 {
     Manager         = FindObjectOfType <WayPointManager>();
     currentWayPoint = Manager.head;
     wayPoints       = Manager.CopyPoints(fromIndex, endIndex - fromIndex);
     StartCoroutine(CheckWaypointDistance());
 }
Exemplo n.º 2
0
    public void ClaimNewWaypoint(WayPointType.PointType.WAYPOINT_TYPE wantedType, bool mustBeFree)
    {
        Waypoint newTarget = null;

        if (wantedType == WayPointType.PointType.WAYPOINT_TYPE.RETREATING)
        {
            newTarget = WayPointManager.ClosestWaypoint(transform.position, WayPointManager.GetAllRetreatWayPoints(), mustBeFree);
        }
        else if (wantedType == WayPointType.PointType.WAYPOINT_TYPE.READY_TO_FIGHT)
        {
            newTarget = WayPointManager.ClosestWaypoint(transform.position, WayPointManager.GetAllReadyToAttackWayPoints(), mustBeFree);
        }
        else if (wantedType == WayPointType.PointType.WAYPOINT_TYPE.ATTACKING)
        {
            newTarget = WayPointManager.ClosestWaypoint(transform.position, WayPointManager.GetAllAttackWayPoints(), mustBeFree);
        }
        if (m_CurrentTarget != null)
        {
            m_CurrentTarget.SetOwner(null);
        }
        if (newTarget != null)
        {
            m_CurrentTarget = newTarget;
            m_CurrentTarget.SetOwner(this.gameObject);
        }
        else
        {
            m_CurrentTarget = null;
        }
    }
Exemplo n.º 3
0
 // Start is called before the first frame update
 protected override void Start()
 {
     base.Start();
     mWPM = GetComponent <WayPointManager>();
     SetDestination(mWPM.NextWaypoint(), OnAgentResult);
     Selected = false;
 }
    private void Awake()
    {
        wayPointManager = GetComponent <WayPointManager>();

        level();
        // GetJsonToLevelData("Mission.json");
    }
Exemplo n.º 5
0
    void Awake()
    {
        instance = this;

        var waypoints = FindObjectsOfType <EnemyWP> ();

        foreach (EnemyWP wp in waypoints)
        {
            if (!grid.ContainsKey(wp.EwpID))
            {
                grid.Add(wp.EwpID, wp);
            }
        }

        var tiles = FindObjectsOfType <WP> ();

        foreach (WP _tile in tiles)
        {
            if (!tile.ContainsKey(_tile.Pos))
            {
                tile.Add(_tile.Pos, _tile);
            }
            else
            {
                print("DoubleTile : " + _tile);                  //Debug
            }
        }
    }
Exemplo n.º 6
0
 void Start()
 {
     _move     = GetComponent <Move> ();
     _uStats   = GetComponent <UnitStats> ();
     _wpManage = GameObject.Find("_WayPoint_holder").GetComponent <WayPointManager> ();
     _player   = GameObject.FindGameObjectWithTag("PlayerCC");
     _anim     = GetComponent <AnimCtrl_Enemy> ();
 }
Exemplo n.º 7
0
 void Awake()
 {
     //This is a simplified version of the singleton pattern,
     //which allows easy access to a manager-type class from anywhere.
     //The keyword this refers to the class it’s written in;
     //in this case, WayPointManager
     Instance = this;
 }
    void Start()
    {
        steeringVehicle = GetComponent <SteeringVehicle>();
        wayPointManager = GetComponent <WayPointManager>();

        waypointAction += SetWaypointTarget;
        steeringVehicle.SetTarget(wayPointManager.GetFirstWayPoint().position);
    }
Exemplo n.º 9
0
    protected virtual void OnSceneGUI()
    {
        Tools.current = Tool.None;
        WayPointManager wpManager = (WayPointManager)target;

        int count = wpManager.WayPoints.Count;

        for (int i = 0; i < count - 1; i++)
        {
            if (!wpManager.persistentGizmos)
            {
                // Draw handles for waypoint positions
                Handles.color = wpManager.pointColor;
                Handles.CubeHandleCap(0, wpManager.WayPoints[i].position, Quaternion.identity, wpManager.debugRadius, EventType.Repaint);
                Handles.color = wpManager.lineColor;
                Handles.DrawLine(wpManager.WayPoints[i].position, wpManager.WayPoints[i + 1].position);

                if (wpManager.useLookPoints)
                {
                    // Draw handles for waypoint look positions
                    Handles.color = wpManager.lookPointColor;
                    Handles.SphereHandleCap(0, wpManager.WayPoints[i].lookPoint, Quaternion.identity, wpManager.debugRadius, EventType.Repaint);
                    Handles.color = wpManager.lineOfSightColor;
                    Handles.DrawLine(wpManager.WayPoints[i].position, wpManager.WayPoints[i].lookPoint);
                }
            }
            // Update positions using standard xyz position handles
            wpManager.WayPoints[i].position = Handles.PositionHandle(wpManager.WayPoints[i].position, Quaternion.identity);

            if (wpManager.useLookPoints)
            {
                // Update lookpoint positions using xyz handles
                wpManager.WayPoints[i].lookPoint = Handles.PositionHandle(wpManager.WayPoints[i].lookPoint, Quaternion.identity);
            }
        }
        if (count >= 1)
        {
            if (!wpManager.persistentGizmos)
            {
                // Draw waypoint positions
                Handles.color = wpManager.pointColor;
                Handles.CubeHandleCap(0, wpManager.WayPoints[count - 1].position, Quaternion.identity, wpManager.debugRadius, EventType.Repaint);

                if (wpManager.useLookPoints)
                {
                    // Draw lookpoints
                    Handles.color = wpManager.lookPointColor;
                    Handles.SphereHandleCap(0, wpManager.WayPoints[count - 1].lookPoint, Quaternion.identity, wpManager.debugRadius, EventType.Repaint);
                    Handles.DrawLine(wpManager.WayPoints[count - 1].position, wpManager.WayPoints[count - 1].lookPoint);
                }
            }
            wpManager.WayPoints[count - 1].position = Handles.PositionHandle(wpManager.WayPoints[count - 1].position, Quaternion.identity);
            if (wpManager.useLookPoints)
            {
                wpManager.WayPoints[count - 1].lookPoint = Handles.PositionHandle(wpManager.WayPoints[count - 1].lookPoint, Quaternion.identity);
            }
        }
    }
Exemplo n.º 10
0
        public override void OnInspectorGUI()
        {
            EditorGUIUtility.LookLikeInspector();
            WayPointManager WPManager = target as WayPointManager;

            WPManager.name = WPManager.name;

            CoreFunctions.CreateRGKWayPointManagerInspector(WPManager);
        }
Exemplo n.º 11
0
    void Awake()
    {
        instance = this;

        for (int i = 0; i < wayPoints.Length; i++)
        {
            wayPoints[i] = transform.GetChild(i).position;
        }
    }
Exemplo n.º 12
0
 void Start()
 {
     this.navMeshAgent = this.GetComponent<NavMeshAgent>();
     player = GameObject.FindGameObjectWithTag("Player");
     waypointManager = GameObject.FindGameObjectWithTag("WaypointManager").GetComponent<WayPointManager>();
     teddyCount = GameObject.FindGameObjectWithTag("Counter").GetComponent<TeddyCount>();
     firstNode = waypointManager.ReturnRandomNode();
     newNode = firstNode;
     lastNode = newNode;
 }
Exemplo n.º 13
0
 // Use this for initialization
 void Start()
 {
     isRunning       = false;
     isAttack        = false;
     isDeath         = false;
     inFOV           = false;
     duringOperation = false;
     wayPointManager = GetComponent <WayPointManager>();
     animator        = GetComponent <Animator>();
     navMeshAgent    = GetComponent <NavMeshAgent>();
 }
Exemplo n.º 14
0
    public List <Transform> RouteBottomR = new List <Transform> ();  //set Manually
//	public List<Transform> RouteCentre;
//	public List<Transform> RouteRandom;


    void Awake()
    {
        instance = this;

        _wp = GameObject.FindGameObjectsWithTag("enemyWP");

        for (int i = 0; i < _wp.Length; i++)
        {
            _wp [i].name = "enemyWP " + i;
            tempL.Add(_wp [i].transform);
        }
    }
Exemplo n.º 15
0
    void Start()
    {
        // Get the waypoint manager from the scene - use a name of the object here so
        // we can have multiple sets of waypoints in the scene and differentiate between them
        wayPoints = GameObject.Find(WayPointName).GetComponent <WayPointManager>();

        // Make sure we found a waypoint manager
        if (wayPoints == null)
        {
            Debug.LogError("No waypoint manager found.");
        }
    }
Exemplo n.º 16
0
    void GoCheckout()
    {
        foreach (GameObject waypoint in GameManager.CheckStand)
        {
            WayPointManager RoomManager = waypoint.GetComponent <WayPointManager>();

            if ((RoomManager.RoomName == "Checkout 1" && RoomManager.available) || (RoomManager.RoomName == "Checkout 2" && RoomManager.available) ||
                (RoomManager.RoomName == "Checkout 3" && RoomManager.available) || (RoomManager.RoomName == "Checkout 4" && RoomManager.available))
            {
                point.GetComponent <WayPointManager>().available = false;
                point = waypoint;
            }
        }
    }
Exemplo n.º 17
0
    private void Awake()
    {
        for (int i = 0; i < m_obstacleLayers.Length; i++)
        {
            m_obstacleLayer = m_obstacleLayer | 1 << (int)m_obstacleLayers[i];
        }

        m_wayPointManager  = WayPointManager.Instance;
        m_leftDownPosition = m_leftDownTransform.position;
        m_rightUpPosition  = m_rightUpTransform.position;
        m_leftDownKey      = m_wayPointManager.ConvertPositionToKey(m_leftDownPosition);
        m_rightUpKey       = m_wayPointManager.ConvertPositionToKey(m_rightUpPosition);
        m_centerPosition   = new Vector2((m_leftDownPosition.x + m_rightUpPosition.x) * 0.5f, (m_leftDownPosition.y + m_rightUpPosition.y) * 0.5f);
        m_centerKey        = m_wayPointManager.ConvertPositionToKey(m_centerPosition);
        m_gapSize          = m_wayPointManager.GapSize;
        m_gapSize          = new Vector2(m_gapSize.x * 0.9f, m_gapSize.y * 0.9f);
    }
Exemplo n.º 18
0
 public override void notifyConstructDone()
 {
     base.notifyConstructDone();
     if (mGame == null)
     {
         mGame             = Game.instance as Game;
         mGameConfig       = mGame.getSystem <GameConfig>();
         mHardwareInfo     = mGame.getSystem <HardwareInfo>();
         mSocketNetManager = mGame.getSystem <SocketManager>();
         mGameInputManager = mGame.getSystem <GameInputManager>();
         mUSBManager       = mGame.getSystem <USBManager>();
         mGameSetting      = mGame.getSystem <GameSetting>();
         mRoleSystem       = mGame.getSystem <RoleSystem>();
         mRaceSystem       = mGame.getSystem <RaceSystem>();
         mItemManager      = mGame.getSystem <SceneItemManager>();
         mLogSystem        = mGame.getSystem <LogSystem>();
         mFrameLogSystem   = mLogSystem;
         mRegisterTool     = mGame.getSystem <RegisterTool>();
         mWayPointManager  = mGame.getSystem <WayPointManager>();
         mGameUtility      = mGame.getSystem <GameUtility>();
     }
 }
Exemplo n.º 19
0
    private IWayPointManager CreateNew <T>(NodeType nodeType)
        where T : WayPoint
    {
        switch (nodeType)
        {
        case NodeType.Single:
        {
            WayPointManager <T> node = Singleton.Instance <WayPointManager <T> >();
            node.SetType(NodeType.Single);
            return(node.Manager);
        }

        case NodeType.Range:
        {
            WayPointManager <T> node = Singleton.Instance <WayPointManager <T> >();
            node.SetType(NodeType.Range);
            return(node.Manager);
        }
        }

        return(null);
    }
Exemplo n.º 20
0
    void DrawCustomInspector()
    {
        WayPointManager wpManager = (WayPointManager)target;

        wpManager.newWayPointOffset  = EditorGUILayout.Vector3Field("New WayPoint Offset", wpManager.newWayPointOffset);
        wpManager.newLookPointOffset = EditorGUILayout.Vector3Field("New LookPoint Offset", wpManager.newLookPointOffset);

        // WayPoint gizmos
        wpManager.debugRadius = EditorGUILayout.FloatField("Gizmo Size", wpManager.debugRadius);
        wpManager.pointColor  = EditorGUILayout.ColorField("WayPoint Colour", wpManager.pointColor);
        wpManager.lineColor   = EditorGUILayout.ColorField("WayPoint Line Colour", wpManager.lineColor);

        // LookPoint gizmos
        wpManager.useLookPoints = GUILayout.Toggle(wpManager.useLookPoints, "Show LookPoints");
        if (wpManager.useLookPoints)
        {
            wpManager.lookPointColor   = EditorGUILayout.ColorField("LookPoint Colour", wpManager.lookPointColor);
            wpManager.lineOfSightColor = EditorGUILayout.ColorField("LookPoint Line Colour", wpManager.lineOfSightColor);
        }

        wpManager.persistentGizmos = GUILayout.Toggle(wpManager.persistentGizmos, "Persistent Gizmos");

        wpManager.showWayPointList = GUILayout.Toggle(wpManager.showWayPointList, "Show WayPoint List");
        // Only draw the list if it's checked
        if (wpManager.showWayPointList)
        {
            int wpCount = wpManager.WayPoints.Count;
            for (int i = 0; i < wpCount; i++)
            {
                EditorGUILayout.Space();
                EditorGUILayout.LabelField("WP " + (i + 1).ToString());
                wpManager.WayPoints[i].position  = EditorGUILayout.Vector3Field("Position", wpManager.WayPoints[i].position);
                wpManager.WayPoints[i].lookPoint = EditorGUILayout.Vector3Field("Look Point", wpManager.WayPoints[i].lookPoint);
            }
        }
    }
Exemplo n.º 21
0
    public override void OnInspectorGUI()
    {
        //DrawDefaultInspector();

        DrawCustomInspector();

        WayPointManager wpManager = (WayPointManager)target;

        if (GUILayout.Button("Add WayPoint"))
        {
            wpManager.AddWayPoint();
            HandleUtility.Repaint();
            SceneView.RepaintAll();
            Repaint();
        }
        GUILayout.Space(10);
        if (GUILayout.Button("Remove Last WayPoint"))
        {
            wpManager.RemoveLastWayPoint();
            Repaint();
            HandleUtility.Repaint();
            SceneView.RepaintAll();
        }
    }
Exemplo n.º 22
0
    private static void EditSelectedWayPoint()
    {
        GameObject selectedGameObject = Selection.activeGameObject;

        Debug.Log("selectedGameObject = " + selectedGameObject.name);

        //this is the WayPointList
        WayPointList wpList = selectedGameObject.GetComponent <WayPointList> ();


        //this is the WayPointManager
        GameObject      WayPointManagerObject = GameObject.Find("WayPointManager");
        WayPointManager wpManager             = WayPointManagerObject.GetComponent <WayPointManager> ();
        string          pName     = wpManager.PrefabName;
        int             numPoints = wpList.NumPointsUsed;
        bool            HasData   = wpList.HasData;

        wpManager.PrefabName    = wpList.PrefabName;
        wpManager.NumPointsUsed = wpList.NumPointsUsed;
        wpManager.HasData       = wpList.HasData;

        Debug.Log("EditSelectedWayPoint : numPoints = " + numPoints);
        for (int i = 0; i < numPoints; i++)
        {
            Vector3 vec = wpList.GetVector3AtIndex(i);
            WayPointManager.Instance.mWayPointEditList [i].transform.position = new Vector3(vec.x, vec.y, vec.z);

            if (HasData == true)
            {
                WayPoint wp = wpList.GetWayPointDataAtIndex(i);
                WayPointManager.Instance.mWayPointEditStructs [i] = wp;
            }
        }

        Debug.Log("wpManager pName = " + pName);
    }
Exemplo n.º 23
0
 void Awake()
 {
     //3
     Instance = this;
 }
Exemplo n.º 24
0
 void Awake()
 {
     Instance = this;
 }
Exemplo n.º 25
0
 private void Awake()
 {
     Instance = this;
 }
Exemplo n.º 26
0
    private static int uniqueID = 0;     // just to number at time of spawn for easier identification

    public static void ResetStatics()
    {
        levelWayPointList = null;
        waypointManager   = null;
        uniqueID          = 0;
    }
Exemplo n.º 27
0
 void Start()
 {
     player = GameObject.FindGameObjectWithTag("Player");
     PlayerPrefs.SetInt("currentScore", 0);
     wayPointManager = GameObject.FindGameObjectWithTag("WaypointManager").GetComponent<WayPointManager>();
 }
Exemplo n.º 28
0
 void Awake()
 {
     //Sets the value explained in entry 1.
     Instance = this;
 }
Exemplo n.º 29
0
    protected override void Init()
    {
        name = "Enemy#" + (uniqueID++);
        GameObject waypointMaster = GameObject.Find("AI_WayPoints");

        if (waypointMaster && waypointManager == null)
        {
            waypointManager   = waypointMaster.GetComponent <WayPointManager>();
            levelWayPointList = new List <Transform>();
            for (int i = 0; i < waypointMaster.transform.childCount; i++)
            {
                Transform wpTransform = waypointMaster.transform.GetChild(i);
                levelWayPointList.Add(wpTransform);
            }
        }

        if (levelWayPointList != null)
        {
            int myWaypointIdx = Random.Range(0, levelWayPointList.Count);
            myWaypoint = levelWayPointList[myWaypointIdx].GetComponent <Waypoint>();
            Waypoint nextWP = myWaypoint.randNext();
            if (waypointManager.isOrdered == false)
            {
                nextWP = levelWayPointList[Random.Range(0, levelWayPointList.Count)].GetComponent <Waypoint>();
            }
            // start ship at random spot between nearest waypoint and next (reduce start collisions)
            transform.position =
                Vector3.Lerp(myWaypoint.transform.position,
                             nextWP.transform.position, Random.Range(0.0f, 1.0f));
            transform.LookAt(nextWP.transform.position);
            randomizeTrackLaneOffset();
            prevWPTrackLeft   = myWaypoint.trackPtForOffset(-1.0f);
            prevWPTrackRight  = myWaypoint.trackPtForOffset(1.0f);
            totalDistToNextWP = Vector3.Distance(nextWP.trackPtForOffset(myTrackLaneOffset),
                                                 myWaypoint.trackPtForOffset(myTrackLaneOffset));
            myWaypoint       = nextWP;
            percLeftToNextWP = 1.0f;
        }
        else
        {
            myWaypoint = null;
        }

        GameObject obstacleList = GameObject.FindGameObjectWithTag("ObstacleList");

        if (obstacleList)
        {
            levelAIAvoidanceManager = obstacleList.GetComponent <LevelAISettings>();
            if (levelAIAvoidanceManager)
            {
                obstacleSafetyThreshold = levelAIAvoidanceManager.AIdetectionRange;
                this.obstacles          = levelAIAvoidanceManager.obstacles;
            }
        }
        else
        {
            levelAIAvoidanceManager = null;
            this.obstacles          = null;
        }

        isAttackingPlayer = false;

        StartCoroutine(AIbehavior());
    }
Exemplo n.º 30
0
 void Awake()
 {
     // Setting the static variable
     Instance = this;
 }
Exemplo n.º 31
0
 void Start()
 {
     waypointManager = GameObject.FindGameObjectWithTag("WaypointManager").GetComponent<WayPointManager>();
 }
 public void Destroy()
 {
     m_instance = null;
 }
 /// <summary>
 /// 활성화된 씬이 변할때 호출되는 이벤트 메소드
 /// </summary>
 /// <param name="arg0"></param>
 /// <param name="arg1"></param>
 private static void SceneManager_activeSceneChanged(Scene arg0, Scene arg1)
 {
     m_instance = new WayPointManager();
 }