Exemple #1
0
    // Use this for initialization
    void Start()
    {
        if (timerTextObject != null)
        {
            text = timerTextObject.GetComponent <Text>();
        }

        currentValue = value;

        if (incomeTextObject != null)
        {
            incomeText = incomeTextObject.GetComponent <Text>();
        }

        if (balanceTextObject != null)
        {
            balanceText = balanceTextObject.GetComponent <Text>();
        }

        if (balanceText != null)
        {
            balanceText.text = appendedBalanceInfo + PlayerManager.GetBalance(PlayerManager.CurrentPlayer).ToString();
            PlayerManager.OnCurrentPlayerBalanceChange += PlayerManager_OnCurrentPlayerBalanceChange;
        }

        if (incomeText != null)
        {
            incomeText.text = appendedIncomeInfo + PlayerManager.GetIncome(PlayerManager.CurrentPlayer).ToString();
            PlayerManager.OnCurrentPlayerIncomeChange += PlayerManager_OnCurrentPlayerIncomeChange;
        }

        timer          = new TaylorTimer(1000);
        timer.Elapsed += Timer_Elapsed;
        FixText();
    }
Exemple #2
0
    // Use this for initialization
    void Start()
    {
        // TODO: Add a random offset so the towers wont fire in sync cause it's loud as hell.
        timer          = new TaylorTimer(60000 / speed);
        timer.Elapsed += Timer_Elapsed;

        meshRenderer = GetComponent <MeshRenderer>();
        audioSource  = GetComponent <AudioSource>();

        SetTowerPosition(gridPositionX, gridPositionY);

        visualizer = gameObject.GetComponent <BezierVisualizer>();

        if (projectileObject != null)
        {
            projectileSize = projectileObject.transform.Find("Projectile_Front").gameObject.GetComponent <MeshRenderer>().bounds.size;//projectileObject.GetComponentInChildren<MeshRenderer>().bounds.size;
        }

        SetSpawnPos();

        if (visualizeBezier)
        {
            VisualizeBezier();
        }

        height = meshRenderer.bounds.max.y;

        creatures = PlayerManager.GetCreatures(ownerID);

        if (radiusVisualizer != null)
        {
            radiusVisualizer.range = range;
        }

        rangeRounded = (int)(range + 0.5f);

        //TEST ONLY:
        Modifiers.Add(new Modifier(ModiferTypes.Fire, 1));
        Modifiers.Add(new Modifier(ModiferTypes.Ice, 1));
        Modifiers.Add(new Modifier(ModiferTypes.Acid, 1));
    }