Inheritance: MonoBehaviour
 //Singleton basique  : Voir unity design patterns sur google.
 void Awake()
 {
     if (upgradeMenu == null)
     {
         upgradeMenu = this;
     }
 }
Beispiel #2
0
    protected override void Awake()
    {
        _sr             = GetComponent <SpriteRenderer>();
        _text           = GetComponent <TextRenderer>();
        _au             = GetComponent <AudioSource>();
        _animator       = GetComponent <Animator>();
        _queuedToLaunch = new List <Planet>();
        _upgradeMenu    = GetComponent <UpgradeMenu>();

        // Add outline visual elements
        _planetOutline        = Instantiate <SpriteRenderer>("HoverOutline", Transform.Position);
        _planetOutline.Sprite = GameController.OutlineSprite;
        _planetOutline.Layer  = 0.6f;
        _planetOutline.GameObject.SetActive(false);

        _rangeOutline        = Instantiate <SpriteRenderer>("RangeOutline", Transform.Position);
        _rangeOutline.Sprite = GameController.RangeSprite;
        _rangeOutline.Color  = new Color(38, 38, 38, 25);
        _rangeOutline.Layer  = 0.61f;

        UpdateAppearance();

        OnPopulationChange += UpdatePopulationText;
        OnPopulationChange();
    }
Beispiel #3
0
 void Start()
 {
     CreateSpawns();
     waveCountDown = secondsBetweenWaves;
     upgradeMenu   = GameObject.FindGameObjectWithTag("UpgradeMenu").GetComponent <UpgradeMenu>();
     upgradeMenu.CloseMenu();
     fade = gameObject.GetComponent <TextFade>();
 }
Beispiel #4
0
 public override void Initilize(UpgradeMenu menu, int id)
 {
     base.Initilize(menu, id);
     // get level
     lvl      = UIMasterScript.passiveList[id];
     startlvl = lvl;
     UpdateGraphic();
 }
 // Start is called before the first frame update
 void Start()
 {
     dragging       = false;
     buildMenuObj   = GameObject.FindGameObjectsWithTag("BuildMenu");
     upgradeMenuObj = GameObject.FindGameObjectWithTag("UpgradeMenu");
     upgradeMenu    = upgradeMenuObj.GetComponent <UpgradeMenu>();
     buyMenuObj     = GameObject.FindGameObjectWithTag("BuyTileMenu");
     ClearSelections();
 }
Beispiel #6
0
 public void TotalPointChanged()
 {
     if (UpgradeMenuUI.activeInHierarchy)
     {
         UpgradeMenu menu = UpgradeMenuUI.GetComponent <UpgradeMenu>();
         if (menu != null)
         {
             menu.UpdateTotalPointText();
         }
     }
 }
Beispiel #7
0
    public void OnMouseDown()
    {
        if (upgradeMenuPrefab != null)
        {
            GameObject go = Instantiate <GameObject>(upgradeMenuPrefab);

            UpgradeMenu upgradeMenu = go.GetComponentInChildren <UpgradeMenu>();
            upgradeMenu.Initiate(this);
            upgradeMenu.transform.position = Camera.main.WorldToScreenPoint(transform.position);
        }
    }
Beispiel #8
0
        public void handle_upgrade(Vector3Int oldCell, Vector3Int newCell)
        {
            if ((inverted && newCell.y == 1) || (inverted == false && newCell.y == 8))
            {
                disable_all_piece_colliders();

                GameObject upgradeMenuGameObject = Instantiate(upgradeMenuPrefab);
                upgradeMenu = (UpgradeMenu)upgradeMenuGameObject.GetComponentInChildren(typeof(UpgradeMenu));
                upgradeMenu.connectedPawn = this;
                upgradeMenu.connectButtons();
            }
        }
    public UIController(GameSystem gameSystem) : base(gameSystem)
    {
        _cashLabel   = gameSystem.CashLabel;
        _buildMenu   = gameSystem.BuildMenu;
        _upgradeMenu = gameSystem.UpgradeMenu;
        _startButton = gameSystem.StartButton;

        _startButton.onClick.AddListener(() =>
        {
            gameSystem.GameController.StartGame();
            _startButton.gameObject.SetActive(false);
        });
    }
Beispiel #10
0
    // Use this for initialization
    void Start()
    {
        Time.timeScale = 1;
        gameObject.GetComponent <PauseMenu>().enabled = false;
        upgrades         = gameObject.GetComponent <UpgradeMenu>();
        upgrades.enabled = false;
        pauseRect        = new Rect(Screen.width / 2 - 30, 24, 0, 0);

        if (Constants.multiplayer)
        {
            networkManager = GameObject.Find("Network Manager").GetComponent("NetworkManager") as NetworkManager;
        }
    }
    void Start()
    {
        GameObject earth  = GameObject.FindGameObjectWithTag("Earth");
        GameObject player = GameObject.FindGameObjectWithTag("Player");

        playerHealth = player.GetComponent <PlayerHealth>();
        playerWeapon = player.GetComponent <PlayerWeapon>();
        scoreKeeping = player.GetComponent <ScoreKeeping>();
        earthHealth  = earth.GetComponent <EarthHealth>();
        upgradeMenu  = gameObject.GetComponent <UpgradeMenu>();

        if (upgradeMenu != null)
        {
            RefreshTexts();
            ToggleUpgradeButtons();
        }
    }
Beispiel #12
0
 void Start()
 {
     upgradeMenu = GameObject.Find("UpgradeManager").GetComponent <UpgradeMenu>();
     enemyList   = GameObject.Find("GameManager").GetComponent <EnemyCreation>();
     gameSystems = GameObject.Find("GameManager").GetComponent <GameSystems>();
     spawnPoint  = GameObject.Find("SpawnPoint");
     mobInfo     = GameObject.Find("MobInfo").GetComponent <MobInfo>();
     for (int i = 0; i < Points.Count; i++)
     {
         Points[i] = GameObject.Find("Point_" + i);
     }
     _currentSpeed = enemyData.speed * upgradeCoinData.difficulty;
     _health       = enemyData.maxHealth * upgradeCoinData.difficulty;
     gameObject.GetComponent <Image>().sprite = enemyData.mobImage;
     StartCoroutine(MovingToPoints());
     StartCoroutine(Aliments());
 }
Beispiel #13
0
 private void Awake()
 {
     Current = this;
 }
Beispiel #14
0
 void Start()
 {
     Instance = this;
 }
Beispiel #15
0
 public virtual void Initilize(UpgradeMenu menu, int id)
 {
     UIMasterScript = menu;
     gradeID        = id;
     Discount       = 1f;
 }
Beispiel #16
0
 public void HideUpgradeMenu()
 {
     _pause.Hide();
     _pause = null;
 }
Beispiel #17
0
 public void ShowUpgradeMenu()
 {
     _pause = new UpgradeMenu();
     _pause.Show();
 }
Beispiel #18
0
 // Use this for initialization
 void Start()
 {
     menu = upgradeMenuGUI.GetComponent <UpgradeMenu>();
 }
Beispiel #19
0
 // Start is called before the first frame update
 void Start()
 {
     level       = 0;
     upgradeMenu = GameObject.Find("UpgradeManager").GetComponent <UpgradeMenu>();
 }