Esempio n. 1
0
    // Use this for initialization
    void Awake()
    {
        instance = this;

        worldState = GetComponent <WorldState>();

        wayPointSystem = GetComponent <WayPointSystem>();


        wayPointSystem.CreateWaypointGrid();
        Debug.Log("Creating obstacles");
        for (int i = 0; i < numOfObstacles; i++)
        {
            obstacles.Add(Instantiate(ObstaclePrefab, GetObstacleCoordinate(), new Quaternion()));
            obstacles[i].transform.SetParent(gameObject.transform);
            obstacles[i].GetComponent <Obstacle>().GenerateObstacle2(Random.Range(4, 17));
            worldState.obstacles.Add(obstacles[i].GetComponent <Obstacle>());
        }
        timer                     = 0;
        doorInt                   = 0;
        currentNumOfWanders       = 0;
        currentNumOfSocials       = 0;
        currentNumberOfTravellers = 0;
        canStart                  = true;
    }
 // Use this for initialization
 void Start()
 {
     if (falls || moveOnPlayerLand)
     {
         waypoint = transform.parent.GetComponent <WayPointSystem>();
         anim     = GetComponent <Animator>();
     }
 }
Esempio n. 3
0
 void Start()
 {
     if (gameObject.tag == "Boss")
     {
         boss = FindObjectOfType <BossBehaviour>();
     }
     else
     {
         waypointSystem = FindObjectOfType <WayPointSystem>();
     }
 }
Esempio n. 4
0
    private IEnumerator SpawnWaiting()
    {
        WaitForSeconds wait = new WaitForSeconds(timeBetweenSpawns);

        yield return(wait);

        for (int i = 0; i < enemySpawn.enemy.Count; i++)
        {
            for (int j = 0; j < Mathf.RoundToInt(enemySpawn.amountOfEnemies.Evaluate(i)); j++)
            {
                Instantiate(enemySpawn.enemy[i], WayPointSystem.GetStartPoint().position, Quaternion.identity);
                yield return(wait);
            }
        }
    }
Esempio n. 5
0
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();

        WayPointSystem wayPointSystem = (WayPointSystem)target;

        if (GUILayout.Button("Assign numbered names"))
        {
            wayPointSystem.RenameChildren();
        }
        if (GUILayout.Button("Compute initial Path using all child objects"))
        {
            if (wayPointSystem.initiated && EditorUtility.DisplayDialog("Warning", "You already calculated the initial path, recalculating it will undo all custom tweaks you made. Do you want to continue?", "yes", "no"))
            {
                wayPointSystem.Initiate();
            }
            else if (!wayPointSystem.initiated)
            {
                wayPointSystem.Initiate();
            }
        }
    }
Esempio n. 6
0
    public void CreateCheckPoints()
    {
        if (wpSystem == null)
        {
            wpSystem = FindObjectOfType <WayPointSystem>();
        }

        for (int i = 0; i < wpSystem.points.Length; i++)
        {
            int nextWp = i + 1;
            if (nextWp >= wpSystem.points.Length)
            {
                nextWp = 0;
            }

            GameObject go = Instantiate(checkpointPref);
            go.transform.position = wpSystem.points[i];
            go.transform.LookAt(wpSystem.points[nextWp]);
            go.name             = i.ToString();
            go.transform.parent = transform;
        }
    }
 void Start()
 {
     system = GameObject.Find("WayPointSystem").GetComponent <WayPointSystem> ();
     newPos = Vector3.forward;
 }
Esempio n. 8
0
 void Start()
 {
     main = GameObject.Find("WayPointSystem").GetComponent <WayPointSystem> ();
     cam  = Camera.main;
 }
Esempio n. 9
0
 static public void InitializeEnemySystem(EnemySpawnSystem s, WayPointSystem w)
 {
     sEnemySystem = s; sWayPoints = w;
 }
Esempio n. 10
0
 // Use this for initialization
 void Start()
 {
     pointSystem = this;
     //CreateWaypointGrid();
     //CreatePaths();
 }
Esempio n. 11
0
 private void Awake()
 {
     AvatarGravity  = GetComponent <GravityHandler>();
     wayPointSystem = GetComponent <WayPointSystem>();
 }
 private void OnEnable()
 {
     waypointSystem = target as WayPointSystem;
 }