private void OnMouseDown() { isClicked = true; if (!isAdded) { StarsCounter.AddStar(); isAdded = true; } }
void Start() { sfxManager = FindObjectOfType <SFXManager>(); gameCamera = FindObjectOfType <Camera>(); starsCounter = FindObjectOfType <StarsCounter>(); defenderParent = GameObject.Find("Defenders"); if (!defenderParent) { defenderParent = new GameObject("Defenders"); } }
private void OnMouseDown() { if (IsEmpty()) { if (StarsCounter.UseStar(Button.selectedDefender.GetComponent <Defender>().cost)) { GameObject d = Instantiate(Button.selectedDefender, WorldUnitOfMousePosition(), Quaternion.identity); d.transform.parent = defenders.transform; if (StarsCounter.count < Button.selectedDefender.GetComponent <Defender>().cost) { Button.selectedDefender = null; } } else { } } }
public void Init(int part, int level) { GameObject levelInstance = Instantiate(Resources.Load(string.Format("Levels/{0}/{1}", part, level), typeof(GameObject))) as GameObject; BoardInitInfo boardInitInfo = levelInstance.GetComponent <BoardInitInfo>(); starCounter = levelInstance.GetComponent <StarsCounter>(); gameStat = new GameStat(); board = gameObject.GetComponentInChildren <Board>(); player = FindObjectOfType <Player>(); board.Init(boardInitInfo); score = 0; scoreText = GameObject.Find("Score").GetComponent <TextMeshProUGUI>(); targets = levelInstance.GetComponents <Target>(); game = levelInstance.GetComponent <Game>(); game.Init(); }
void Awake() { if (starsCounter == null) { starsCounter = FindObjectOfType <StarsCounter>(); } if (towerInfoMenu == null) { towerInfoMenu = FindObjectOfType <UpgradeMenuTowerInfo>(); } if (!subscribedToUpdateState) { subscribedToUpdateState = true; updateState += UpdateLocalInfo; } gameObject.SetActive(false); if (disabledButtonColor != new Color()) { disabledButtonColor = new Color(); } }
void Start() { sfxManager = FindObjectOfType <SFXManager>(); starsCounter = FindObjectOfType <StarsCounter>(); if (!starsCounter) { Debug.Log("Stars counter not found"); } if (!Parent) { Debug.Log("Parent object nt set."); } else { animator = Parent.GetComponent <Animator>(); if (!animator) { Debug.Log("Animator not found."); } } }
void Start() { sfxManager = FindObjectOfType <SFXManager>(); starsCounter = FindObjectOfType <StarsCounter>(); shooter = GetComponentInChildren <Shooter>(); }