void OnTriggerEnter2D(Collider2D other) { interactor = other.gameObject; interactor_script = interactor.GetComponent <player_control>(); interactor_rb = interactor.GetComponent <Rigidbody2D>(); is_in = true; }
// Start is called before the first frame update void Start() { player = GameObject.FindGameObjectWithTag("Player").GetComponent <player_control>(); last_block.is_created = false; block = gameObject.GetComponent <block_creator>(); lev_ctrl = new level_control(); lev_ctrl.Initialize(); }
void Awake() { if (Instance == null) s_Instance = this; else Destroy(this.gameObject); s_nResources = Settings.s_nPlayerInitialResourceCount; m_SquadCaptainNode = GameObject.Find("Node_Captain_SpawnPos").transform; spwnCptBtnGO = transform.GetChild(3).GetChild(0).gameObject; spawnCtrlCanvasGrp = transform.GetChild(3).GetComponent<CanvasGroup>(); leftNodeCanvasGrp = transform.GetChild(4).GetComponent<CanvasGroup>(); rightNodeCanavsGrp = transform.GetChild(5).GetComponent<CanvasGroup>(); mainCellPos = transform.GetChild(6).GetComponent<RectTransform>().localPosition; spwnCptBtnRectTransform = spawnCtrlCanvasGrp.transform.GetChild(0).GetComponent<RectTransform>(); spwnCptBtnPos = spwnCptBtnRectTransform.localPosition; playerHurtTintCanvasGrp = transform.GetChild(7).GetChild(0).GetComponent<CanvasGroup>(); enemyWarningTintCanvasGrp = transform.GetChild(7).GetChild(1).GetComponent<CanvasGroup>(); leftNodeChildText = transform.GetChild(7).GetChild(2).GetChild(0).GetComponent<Text>(); rightNodeChildText = transform.GetChild(7).GetChild(2).GetChild(1).GetComponent<Text>(); nutrientText = transform.GetChild(7).GetChild(3).GetComponent<Text>(); infoPanelCanvasGrp = transform.GetChild(7).GetChild(4).GetComponent<CanvasGroup>(); infoText = transform.GetChild(7).GetChild(4).GetChild(0).GetComponent<Text>(); pausePanelCanvasGrp = transform.GetChild(8).GetComponent<CanvasGroup>(); pauseButtonImage = transform.GetChild(9).GetComponent<Image>(); controlImages = new Image[9]; controlImages[0] = transform.GetChild(4).GetChild(3).GetComponent<Image>(); // Left BurstShot. controlImages[1] = transform.GetChild(4).GetChild(2).GetComponent<Image>(); // Left SwarmTarget. controlImages[2] = transform.GetChild(4).GetChild(1).GetComponent<Image>(); // Left ScatterShot. controlImages[3] = transform.GetChild(4).GetChild(0).GetComponent<Image>(); // Left DefendAvoid. controlImages[4] = transform.GetChild(5).GetChild(3).GetComponent<Image>(); // Right BurstShot. controlImages[5] = transform.GetChild(5).GetChild(2).GetComponent<Image>(); // Right SwarmTarget. controlImages[6] = transform.GetChild(5).GetChild(1).GetComponent<Image>(); // Right ScatterShot. controlImages[7] = transform.GetChild(5).GetChild(0).GetComponent<Image>(); // Right DefendAvoid. controlImages[8] = transform.GetChild(3).GetChild(0).GetComponent<Image>(); // SpwnCpt Btn. for (int i = 0; i < controlImages.Length; i++) { controlImages[i].color = m_unselectedColor; } // Hide controls, tints, and info panel. spawnCtrlCanvasGrp.alpha = 0f; leftNodeCanvasGrp.alpha = 0f; rightNodeCanavsGrp.alpha = 0f; DeselectAllCtrls(); playerHurtTintCanvasGrp.alpha = 0f; enemyWarningTintCanvasGrp.alpha = 0f; infoPanelCanvasGrp.alpha = 0f; SetPausePanelVisibility(false); pauseButtonImage.enabled = true; // Initialize spawn variables m_bIsHoldingDownSpawnBtn = false; m_fHoldTime = 0f; // Create Animate objects. m_ResourceTextAnimate = new Animate(transform.GetChild(7).GetChild(3)); m_LeftNodeChildTextAnimate = new Animate(transform.GetChild(7).GetChild(2).GetChild(0)); m_RightNodeChildTextAnimate = new Animate(transform.GetChild(7).GetChild(2).GetChild(1)); }
public static void ResetStatics() { s_Instance = null; }
// Use this for initialization void Start() { pc = player.gameObject.GetComponent <player_control> (); slid = GetComponent <Slider> (); }
void Awake() { if (Instance == null) { s_Instance = this; } else { Destroy(this.gameObject); } s_nResources = Settings.s_nPlayerInitialResourceCount; m_SquadCaptainNode = GameObject.Find("Node_Captain_SpawnPos").transform; spwnCptBtnGO = transform.GetChild(3).GetChild(0).gameObject; spawnCtrlCanvasGrp = transform.GetChild(3).GetComponent <CanvasGroup>(); leftNodeCanvasGrp = transform.GetChild(4).GetComponent <CanvasGroup>(); rightNodeCanavsGrp = transform.GetChild(5).GetComponent <CanvasGroup>(); mainCellPos = transform.GetChild(6).GetComponent <RectTransform>().localPosition; spwnCptBtnRectTransform = spawnCtrlCanvasGrp.transform.GetChild(0).GetComponent <RectTransform>(); spwnCptBtnPos = spwnCptBtnRectTransform.localPosition; playerHurtTintCanvasGrp = transform.GetChild(7).GetChild(0).GetComponent <CanvasGroup>(); enemyWarningTintCanvasGrp = transform.GetChild(7).GetChild(1).GetComponent <CanvasGroup>(); leftNodeChildText = transform.GetChild(7).GetChild(2).GetChild(0).GetComponent <Text>(); rightNodeChildText = transform.GetChild(7).GetChild(2).GetChild(1).GetComponent <Text>(); nutrientText = transform.GetChild(7).GetChild(3).GetComponent <Text>(); infoPanelCanvasGrp = transform.GetChild(7).GetChild(4).GetComponent <CanvasGroup>(); infoText = transform.GetChild(7).GetChild(4).GetChild(0).GetComponent <Text>(); pausePanelCanvasGrp = transform.GetChild(8).GetComponent <CanvasGroup>(); pauseButtonImage = transform.GetChild(9).GetComponent <Image>(); controlImages = new Image[9]; controlImages[0] = transform.GetChild(4).GetChild(3).GetComponent <Image>(); // Left BurstShot. controlImages[1] = transform.GetChild(4).GetChild(2).GetComponent <Image>(); // Left SwarmTarget. controlImages[2] = transform.GetChild(4).GetChild(1).GetComponent <Image>(); // Left ScatterShot. controlImages[3] = transform.GetChild(4).GetChild(0).GetComponent <Image>(); // Left DefendAvoid. controlImages[4] = transform.GetChild(5).GetChild(3).GetComponent <Image>(); // Right BurstShot. controlImages[5] = transform.GetChild(5).GetChild(2).GetComponent <Image>(); // Right SwarmTarget. controlImages[6] = transform.GetChild(5).GetChild(1).GetComponent <Image>(); // Right ScatterShot. controlImages[7] = transform.GetChild(5).GetChild(0).GetComponent <Image>(); // Right DefendAvoid. controlImages[8] = transform.GetChild(3).GetChild(0).GetComponent <Image>(); // SpwnCpt Btn. for (int i = 0; i < controlImages.Length; i++) { controlImages[i].color = m_unselectedColor; } // Hide controls, tints, and info panel. spawnCtrlCanvasGrp.alpha = 0f; leftNodeCanvasGrp.alpha = 0f; rightNodeCanavsGrp.alpha = 0f; DeselectAllCtrls(); playerHurtTintCanvasGrp.alpha = 0f; enemyWarningTintCanvasGrp.alpha = 0f; infoPanelCanvasGrp.alpha = 0f; SetPausePanelVisibility(false); pauseButtonImage.enabled = true; // Initialize spawn variables m_bIsHoldingDownSpawnBtn = false; m_fHoldTime = 0f; // Create Animate objects. m_ResourceTextAnimate = new Animate(transform.GetChild(7).GetChild(3)); m_LeftNodeChildTextAnimate = new Animate(transform.GetChild(7).GetChild(2).GetChild(0)); m_RightNodeChildTextAnimate = new Animate(transform.GetChild(7).GetChild(2).GetChild(1)); }
public static void ResetStatics() { s_Instance = null; }