void Start() { if (FindObjectOfType <SimpleGameManager>()) { manager = FindObjectOfType <SimpleGameManager>(); } }
void Awake() { lives = GetComponentsInChildren <Image>(); manager = FindObjectOfType <SimpleGameManager>(); AdjustUI(manager.PlayerLives); manager.OnLivesChanged += new OnPlayerLivesChanged(AdjustUI); }
public void setFromGameManager() { SimpleGameManager gm = GameObject.Find("GameManager").GetComponent <SimpleGameManager>(); this.level = gm.level; //this.checkPoint = gm.getCheckpoint(); }
void Awake() { GM = SimpleGameManager.Instance; GM.OnStateChange += HandleOnStateChange; Debug.Log("Current game state when Awakes: " + GM.gameState); }
public override void CollectObservations() { // Ray Perception //var rayDistance = 50f; //float[] rayAngles = { 0f, 45f, 90f, 135f, 180f, 110f, 70f, -180 }; //var detectableObjects = new[] { "Player", "wall" }; //rays = m_Self.m_RayPerception.Perceive(rayDistance, rayAngles, detectableObjects, 0f, 0f); //AddVectorObs(rays); Vector3 normalizedPosSelf = SimpleGameManager.GetNormalizedPosition(transform); AddVectorObs(normalizedPosSelf.x); AddVectorObs(normalizedPosSelf.z); Vector3 normalizedPosOther = SimpleGameManager.GetNormalizedPosition(m_Other.m_Movement.transform); AddVectorObs(normalizedPosSelf.x); AddVectorObs(normalizedPosSelf.z); // Distance to other float distance = Vector3.Distance(normalizedPosSelf, normalizedPosOther); AddVectorObs(distance); // Rotation float rot = transform.rotation.eulerAngles.y; float normalizedRot = ((rot % 360) / 360); AddVectorObs(normalizedRot); }
private void Setup() { m_GameManager = FindObjectOfType <SimpleGameManager>(); m_Self = new TankComponents { m_Health = GetComponent <SimpleTankHealth>(), m_Movement = GetComponent <SimpleTankMovement>(), m_Shooting = GetComponent <SimpleTankShooting>(), m_RayPerception = GetComponent <RayPerception>() }; GameObject[] players = GameObject.FindGameObjectsWithTag("Player"); for (int i = 0; i < players.Length; i++) { if (GameObject.ReferenceEquals(players[i], this.gameObject)) { continue; } else { m_Other = new TankComponents { m_Health = players[i].GetComponent <SimpleTankHealth>(), m_Movement = players[i].GetComponent <SimpleTankMovement>(), m_Shooting = players[i].GetComponent <SimpleTankShooting>(), m_RayPerception = players[i].GetComponent <RayPerception>() }; } } // Init values lastOtherHealth = m_Other.m_Health.m_StartingHealth; lastSelfHealth = m_Self.m_Health.m_StartingHealth; }
// Use this for initialization void Start() { SimpleGameManager gm = GameObject.Find("GameManager").GetComponent <SimpleGameManager>(); gm.OnStateChange += LoadMainMenu; gm.SetGameState(GameState.MAIN_MENU); }
void Awake() { if (FindObjectOfType <SimpleGameManager>()) { manager = FindObjectOfType <SimpleGameManager>(); } }
// Use this for initialization void Start() { manager = FindObjectOfType <SimpleGameManager>(); pauseMenu = GameObject.FindWithTag("PauseMenu"); rb = GetComponent <Rigidbody>(); //Respawn invulnerability StartCoroutine(Respawning()); }
// Use this for initialization void Awake() { checkpoints = new List <CheckPoint>(); gm = GameObject.Find("GameManager").GetComponent <SimpleGameManager>(); foreach (Transform child in transform) { checkpoints.Add(child.gameObject.GetComponent <CheckPoint>()); } }
// Use this for initialization void Awake() { if (FindObjectOfType <SimpleGameManager>()) { manager = FindObjectOfType <SimpleGameManager>(); } manager.SetGameState(GameState.MENU); }
public void ValueChangeCheck() { playersname = input.text; //Greeting to the player Debug.Log("Hello, " + playersname + "Greetings from River Raid 2017!"); manager = FindObjectOfType <SimpleGameManager>(); manager.PlayerName = playersname; }
// Use this for initialization void Start() { PauseScreen = GetComponent <Canvas>(); PauseScreen.enabled = false; Menus = transform.Find("Menus"); Menus.gameObject.SetActive(false); ControlMenu = transform.Find("ControlMenu"); ControlMenu.gameObject.SetActive(false); viewCharacterButton = transform.FindChild("Character Menu"); AbilitiesScreen = Menus.transform.Find("Abilities").gameObject; AbilitiesScreen.SetActive(false); CustomizeScreen = Menus.transform.Find("Customize").gameObject; CustomizeScreen.SetActive(false); attributesScreen = AbilitiesScreen.transform.Find("Attributes").gameObject; XPText = attributesScreen.transform.GetChild(0).GetComponent <Text>(); StrengthText = attributesScreen.transform.GetChild(1).GetComponent <Text>(); IntellText = attributesScreen.transform.GetChild(2).GetComponent <Text>(); StaminaText = attributesScreen.transform.GetChild(3).GetComponent <Text>(); xpString = XPText.text; strengthString = StrengthText.text; intellString = IntellText.text; staminaString = StaminaText.text; inTacticalPause = false; tm = GameObject.FindWithTag("TeamManager").GetComponent <TeamManager>(); gm = GameObject.Find("GameManager").GetComponent <SimpleGameManager>(); unLockedAbitiesSlots = new List <GameObject>(); setAbilitesSlots = new List <GameObject>(); unLockedAbilitesSlotScripts = new List <SlotScript>(); //get list of unlockedAbility slots Transform unlockedAbilities = AbilitiesScreen.transform.Find("AbilitiesPanel/UnlockedAbilities"); for (int i = 0; i < unlockedAbilities.childCount; i++) { GameObject slot = unlockedAbilities.GetChild(i).gameObject; if (slot.tag.Equals("slot")) { unLockedAbitiesSlots.Add(slot); unLockedAbilitesSlotScripts.Add(slot.GetComponent <SlotScript>()); } } //get list of set ability slots Transform setAbilities = AbilitiesScreen.transform.Find("AbilitiesPanel/SetAbilities "); for (int i = 0; i < 4; i++) { setAbilitesSlots.Add(setAbilities.GetChild(i).gameObject); } basicAbilitySlot = setAbilities.GetChild(4).gameObject; }
void Awake() { if (Instance != null) { Destroy(Instance.gameObject); } Instance = this; player = FindObjectOfType <TraceController>(); }
void Awake() { fuelGauge = GetComponent <Slider>(); manager = Object.FindObjectOfType <SimpleGameManager>(); //Initializing routines if (manager) { fuelLeft = manager.GetComponent <SimpleGameManager>().PlayerFuel; StartCoroutine(FuelLevelWarning()); } }
// Class Methods void Awake() { if (instance == null) { instance = this; DontDestroyOnLoad(this.gameObject); } else { Destroy(gameObject); } }
// Use this for initialization void Start() { saveScreen = GetComponent <Canvas>(); tm = GameObject.Find("TeamManager").gameObject.GetComponent <TeamManager>(); objmanager = GameObject.Find("ObjectiveManager").GetComponent <ObjectiveManager>(); gm = GameObject.Find("GameManager").gameObject.GetComponent <SimpleGameManager>(); for (int i = 0; i < slots.Length; i++) { slots[i] = transform.FindChild("slot" + (i + 1).ToString()).gameObject.GetComponent <SaveButton>(); slots[i].slotNumber = i + 1; SaveLoad.setSaveButton(slots[i]); } saveScreen.enabled = false; }
public void Start() { if (!startCheckpoint) { CheckPointPopUp = transform.Find("cp canvas").gameObject.GetComponent <Canvas>(); autosaveText = CheckPointPopUp.transform.Find("autosavedText").gameObject.GetComponent <Text>(); autosaveText.enabled = false; CheckPointPopUp.enabled = false; SaveScreen = SaveScreenGameObject.GetComponent <SaveSlotScript>(); } inTrigger = false; checkpointReached = false; gm = GameObject.Find("GameManager").GetComponent <SimpleGameManager>(); tm = GameObject.Find("TeamManager").gameObject.GetComponent <TeamManager>(); checkpointManager = transform.parent.gameObject.GetComponent <CheckpointManager>(); objmanager = GameObject.Find("ObjectiveManager").GetComponent <ObjectiveManager>(); }
void Awake() { //Check if instance already exists if (instance == null) { //if not, set instance to this instance = this; } else if (instance != this) { Destroy(gameObject); } //Initializing private variables gameState = GameState.INTRO; InitializeVariables(); //Assigning events OnStateChanged += new OnStateChanged(HandleStateChanges); //ONLY ONE INSTANCE DontDestroyOnLoad(gameObject); }
// Use this for initialization void Awake() { for (int i = 0; i < prefabList.Length; i++) { prefabList[i] = Instantiate(prefabList[i]); } // tacticalPause = GameObject.Find("TacticalPause").GetComponent<TacticalPause>(); gm = GameObject.Find("GameManager").GetComponent <SimpleGameManager>(); playerList = new List <Player>(); for (int i = 0; i < prefabList.Length; i++) { Player player = prefabList[i].GetComponent <Player>(); playerList.Add(player); } playerList.Sort((x, y) => x.id - y.id); cameraScript = Camera.main.GetComponent <OffsetCamera>(); //subject to change visibleEnemies = new HashSet <GameObject>(); deathCount = 0; }
void Awake() { manager = FindObjectOfType <SimpleGameManager>(); player = GameObject.FindWithTag("Player"); }
public void OnApplicationQuit() { instance = null; }
// Use this for initialization void Start() { manager = FindObjectOfType <SimpleGameManager>(); manager.OnScoreChanged += new OnScoreChanged(UpdateScore); }
void Awake() { SGM = SimpleGameManager.Instance; }
void Start() { manager = FindObjectOfType <SimpleGameManager>(); name = manager.PlayerName; nameField.GetComponent <Text>().text = "Hello " + name + "!"; }
void Start() { manager = FindObjectOfType <SimpleGameManager>(); playerName = manager.PlayerName; GetComponent <Text>().text = playerName; }
public void OnApplicationQuit() { SimpleGameManager.instance = null; }
void Awake() { GM = SimpleGameManager.Instance; GM.OnStateChange += HandleOnStateChange; }
public void OnApplicationQuit() { SimpleGameManager.instance = null; }
void Awake() { GM = SimpleGameManager.Instance; GM.OnStateChange += HandleOnStateChange; }
void Awake() { GM = SimpleGameManager.Instance; GM.OnStateChange += HandleOnStateChange; Debug.Log("CurrentGameState When Awake Boi: " + GM.gameState); }