void doStartStuff() { map = GameObject.FindObjectOfType <MapExample>().tiles4; node finish = null; node start = null; foreach (MapTile a in map) { if (a.IsGoal) { finish = new node(a.X, a.Y); Debug.Log("found finish at " + a.X + ", " + a.Y); } else if (a.IsStart) { start = new node(a.X, a.Y); } } path = aStar(start, finish); if (path != null) { targetWaypoint = new Vector3(path[currpoint].x, 1, path[currpoint].y); paused = false; state = playerstate.idle; } else { paused = true; state = playerstate.move; } }
// Start is called before the first frame update void Start() { player = playerstate.idle; sword = GetComponentInChildren <sword_logic>(); collor = new Vector4(1, 0, 0, 1); m_navmeshagent = GetComponent <NavMeshAgent>(); }
public void SetState(playerstate newState) { foreach (PlayerFSMState fsm in states.Values) { fsm.enabled = false; } states[newState].enabled = true; }
public void Transition(playerstate state) { if (states.Contains(new KeyValuePair <playerstate, playerstate>(currentstate, state))) { currentstate = state; } else { Debug.Log("Transition Doesn't exist"); } }
// Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.Space)) { paused = !paused; } if (paused) { state = playerstate.idle; } else { state = playerstate.move; } doStates(); }
void gamecheck(playerstate ps) { switch (ps) { case playerstate.fail: if (GameObject.FindWithTag("UnusedTutorialSound")) { Destroy(GameObject.FindWithTag("UnusedTutorialSound")); } if (GameObject.FindWithTag("UsingTutorialSound")) { Destroy(GameObject.FindWithTag("UsingTutorialSound")); } if (GameObject.FindWithTag("UnusedGameSound")) { Destroy(GameObject.FindWithTag("UnusedGameSound")); } if (GameObject.FindWithTag("UsingGameSound")) { Destroy(GameObject.FindWithTag("UsingGameSound")); } DontDestroyOnLoad(GameObject.Find("GameLog")); Application.LoadLevel("GameOver_page"); break; case playerstate.clear: islinedelete = false; isgodown = false; GameObject.Find("Player").GetComponent <Player_move>().movable = false; GameObject.Find("Player").GetComponent <BoxGun>().shootable = false; win = true; cleartext.enabled = true; break; case playerstate.alive: break; } }