void FindSpawnPoint() { Vector3 p = MMath.GetRandomPointInCircle(player.transform.position, SPAWNRADIUS); gameObject.transform.SetPosition(p); if (helper.CheckLights(gameObject)) { gameObject.transform.SetPositionX(-10000); smc.SetState(respawning); Logger.Log("Monster4 could not spawn, respawning..."); } }
void State_Stalking_Start() { //turn on the mesh and move him near the player //cmesh.setEnabled(true); //find somewhere near the player to spawn STALK_RANGE = DEFAULT_STALK_RANGE; for (int times_to_attempt_spawn = 0; times_to_attempt_spawn <= 5; ++times_to_attempt_spawn) { gameObject.transform.SetPosition(MMath.GetRandomPointInCircle(stealth_player.transform.position, STALK_RANGE)); if (!helper.CheckLights(gameObject)) { break; } STALK_RANGE += 5.0f; if (times_to_attempt_spawn == 5) { smc.SetState(resetting); } } stalk_dir = MMath.GetRandomInt(0, 2); sound.PlayIndependentEvent("C1_CLOSE_LOOP.vente", false, 2); }