Exemplo n.º 1
0
    private void Awake()
    {
        if (!Instance)
        {
            Instance = this;
            // DontDestroyOnLoad (this);
        }
        else
        {
            Destroy(this);
        }

        mainCamera      = Camera.main;
        Raycaster       = mainCamera.GetComponent <Physics2DRaycaster> ();
        spells          = FindObjectOfType <Spells> ();
        field           = FindObjectOfType <Field> ();
        buildingManager = FindObjectOfType <BuildingManager> ();
        attackManager   = FindObjectOfType <AttackManager> ();
        castManager     = FindObjectOfType <CastManager> ();
        enemyController = FindObjectOfType <EnemyController> ();
        touchController = FindObjectOfType <TouchController>();
        wizard          = FindObjectOfType <Wizard> ();
        xpPoints        = wizard.GetComponent <XPpoints> ();
        GameController  = FindObjectOfType <GameController> ();
        uIManager       = FindObjectOfType <UIManager> ();
        firePoints      = FindObjectOfType <FirePoints> ();
    }
Exemplo n.º 2
0
 private void Start()
 {
     GameEvents.current.OnTowerAppear += GetClosestTower;
     oh       = ObjectsHolder.Instance;
     xpPoints = oh.xpPoints;
     hp_norm  = 1f;
     startHp  = hitPoints;
     ec       = oh.enemyController;
     SetBullet();
     healthBarGO.SetActive(false);
     DisplaceZPosition();  // to prevent flicking
     ec.AddCreepToEnemyList(this);
     GetMainTower();
     GetClosestTower();
 }