Exemplo n.º 1
0
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();

        _wayPointPath = (WayPointPath)target;

        if (GUILayout.Button("Get Child"))
        {
            _wayPointPath.wayPoints.Clear();

            int wayPointCount = _wayPointPath.transform.childCount;

            for (int element = 0; element < wayPointCount; element++)
            {
                _wayPointPath.wayPoints.Add(_wayPointPath.transform.GetChild(element));
            }
        }

        if (GUILayout.Button("Auto Rename numberic"))
        {
            int numberic = 0;

            foreach (var wayPoint in _wayPointPath.wayPoints)
            {
                wayPoint.name = "WayPoint" + numberic;
                numberic++;
            }
        }
    }
Exemplo n.º 2
0
    private void Start()
    {
        wayPointPath = wayPointManager.wayPointPaths [creepSpawnerIndex];
        attackSpeed  = unitProperties.attackSpeed;

        aiState = AIState.IDLE;
    }
Exemplo n.º 3
0
        /// <summary>
        /// Gets a path by ID.
        /// </summary>
        public void LoadPathByID(string ID)
        {
            int numPaths = paths.Count;

            for (int p = 0; p < numPaths; p++)
            {
                if (paths[p].ID == ID)
                {
                    activePath  = paths[p];
                    activePoint = 0;
                    startPos    = transform.position;
                    startRot    = transform.rotation;
                    endPos      = activePath.waypoints[activePoint].transform.position;
                    endRot      = activePath.waypoints[activePoint].transform.rotation;
                    //Debug.Log(ID + " path loaded.");
                    Move();
                    break;
                }
            }
        }
Exemplo n.º 4
0
    private void DrawPath()
    {
        _wayPointPath = (WayPointPath)target;

        int wayPointPathCount = _wayPointPath.wayPoints.Count;

        Vector3[] wayPointVector = GetWayPointsToVector3(wayPointPathCount);

        Handles.color = Color.red;
        if (_wayPointPath.isLine == true)
        {
            DrawPathToLine(wayPointPathCount, wayPointVector);
        }

        if (_wayPointPath.isCurve == true)
        {
            for (int i = 0; i < wayPointPathCount - 3; i++)
            {
                Handles.DrawBezier(wayPointVector[i], wayPointVector[i + 1],
                                   wayPointVector[i + 2], wayPointVector[i + 3],
                                   Color.red, null, 2f);
            }
        }
    }
 void OnEnable()
 {
     wp = (WayPointPath)target;
 }
 void OnEnable()
 {
     mn = (MobNavigation)target;
     initPos = mn.transform.position;
     wp = mn.path.GetComponent<WayPointPath>();
 }