예제 #1
0
        public TowerPlacer(TowerManager towerManager)
        {
            this.towerManager = towerManager;

            ViewGroupId = new HashSet <int>();
            Enabled     = true;
        }
예제 #2
0
 // Use this for initialization
 void Start()
 {
     timeStamp=0.0f;
     damage= 10;
     currentTarget=null;
     twr=this.gameObject.GetComponent("TowerManager") as TowerManager;
     // Check where the tower is located and assign appropriate attack zone for it.
     if(twr.isLine0 && twr.isArcher)
     {
         attackArea = GameObject.Find("ArcherAttackBot");
     }
     if(twr.isLine1 && twr.isArcher)
     {
         attackArea = GameObject.Find("ArcherAttackTop");
     }
     if(twr.isLine2 && twr.isArcher)
     {
         attackArea = GameObject.Find("ArcherAttackMid");
     }
     if(twr.isLine3 && twr.isArcher)
     {
         attackArea = GameObject.Find("ArcherAttackTop");
     }
     if(twr.isLine4 && twr.isArcher)
     {
         attackArea = GameObject.Find("ArcherAttackMid");
     }
     // getting component from attack zone, so we can get the monster who enterred the zone.
     enemy =attackArea.gameObject.GetComponent("AttackAreaEnter") as AttackAreaEnter;
 }
예제 #3
0
 static void Main(string[] args)
 {
     Tower firstTower = new Tower();
     Tower secondTower = new Tower();
     Tower thirdTower = new Tower();
     int numRings = args[0];
     for(int i = numRings; i > 0; i--) {
         firstTower.addRing(i);
     }
     
     //print towers after moving
     Console.Write("Towers before moving:\n");
     Console.Write("First Tower in reverse order: ");
     PrintTower(firstTower);
     Console.Write("Second Tower in reverse order: ");
     PrintTower(secondTower);
     Console.Write("Third Tower in reverse order: ");
     PrintTower(thirdTower);
     Console.Write("Number of moves = " + moves + "\n\n");
     
     //create TowerManager object to manage towers and their respective rings
     TowerManager towerManager = new TowerManager();
     //print towers after moving
     towerManager.MoveTowers(firstTower, secondTower, numRings, thirdTower);
     Console.Write("Towers after moving:\n");
     Console.Write("First Tower in reverse order: ");
     PrintTower(firstTower);
     Console.Write("Second Tower in reverse order: ");
     PrintTower(secondTower);
     Console.Write("Third Tower in reverse order: ");
     PrintTower(thirdTower);
     Console.Write("Number of moves = " + moves + "\n");
 }
예제 #4
0
    void Start()
    {
        instance = this;
        //here we need to instantiate every tower so we have access to their basic properties at any time
        //and are able to display their stats, e.g. on mouse over button events
        //(we can't get their properties without instantiation,
        //and its inefficient to instantiate and destroy them every time we need them)
        for (int i = 0; i < towerNames.Count; i++)
        {
            if (towerPrefabs[i] == null)
            {
                Debug.LogWarning("Prefab not set for tower " + (i + 1) + " in TowerManager!");
                return;
            }

            //instantiate tower at a non-visible position
            GameObject tower = (GameObject)Instantiate(towerPrefabs[i], SV.outOfView, Quaternion.identity);
            //rename tower clone to the name given in list "towerNames" ( typed in via inspector)
            tower.name = towerNames[i];
            //parent tower to this gameobject which acts as tower container
            tower.transform.parent = transform;
            //add base properties to list above
            TowerBase tBase = tower.GetComponentInChildren <TowerBase>();
            towerBase.Add(tBase);
            //add upgrade properties to list above
            Upgrade upg = tower.GetComponentInChildren <Upgrade>();
            towerUpgrade.Add(upg);
            tBase.upgrade = upg;
            //deactivate tower and all of its children, so it does not affect our game world
            tower.SetActive(false);
        }
    }
예제 #5
0
        private void Huashan(bool firstHuashan)
        {
            uihost.towerSelectRole.cancel.Visibility = Visibility.Visible;
            uihost.towerSelectRole.confirmBack       = () =>
            {
                foreach (int i in uihost.towerSelectRole.selectedFriends)
                {
                    uihost.towerSelectScene.cannotSelected.Add(RuntimeData.Instance.Team[i].Key);
                }

                this.uihost.Dispatcher.BeginInvoke(() =>
                {
                    Battle battle = TowerManager.getTower(uihost.towerSelectScene.currentTower)[uihost.towerSelectScene.currentIndex];
                    uihost.battleFieldContainer.LoadHuashan(battle, uihost.towerSelectRole.selectedFriends);
                });
            };

            if (firstHuashan)
            {
                uihost.towerSelectScene.loadHuashan();
                uihost.towerSelectScene.currentTower = "华山论剑";
                Battle battle = TowerManager.getTower(uihost.towerSelectScene.currentTower)[uihost.towerSelectScene.currentIndex];
                uihost.towerSelectScene.calcFriend(battle);
                uihost.towerSelectRole.load(uihost.towerSelectScene.maxFriendNo, null, uihost.towerSelectScene.cannotSelected);
            }
            else
            {
                uihost.towerSelectScene.currentIndex++;
                Battle battle = TowerManager.getTower(uihost.towerSelectScene.currentTower)[uihost.towerSelectScene.currentIndex];
                uihost.towerSelectScene.calcFriend(battle);
                uihost.towerSelectRole.load(uihost.towerSelectScene.maxFriendNo, null, uihost.towerSelectScene.cannotSelected);
            }
        }
예제 #6
0
        public void loadHuashan()
        {
            if (!inited)
            {
                Init();
            }
            foreach (String tower in towers)
            {
                bool addTower = true;
                foreach (EventCondition condition in TowerManager.getCondition(tower))
                {
                    if (!TriggerManager.judge(condition))
                    {
                        addTower = false;
                        break;
                    }
                }

                if (addTower && (!towerList.Items.Contains(tower)))
                {
                    towerList.Items.Add(tower);
                }
            }
            currentIndex = 0;
            cannotSelected.Clear();
            bonuses.Clear();
            this.Visibility = Visibility.Collapsed;
        }
예제 #7
0
        public void showBonus()
        {
            /**************************
             *  天关的奖励,从第一层一直奖励到完成的最后一层
             * *************************/

            List <Dialog> dialogs = new List <Dialog>();

            for (int i = 0; i <= currentIndex; i++)
            {
                Battle battle    = TowerManager.getTower(currentTower)[i];
                string BonusItem = bonuses[i];
                RuntimeData.Instance.Items.Add(ItemManager.GetItem(BonusItem).Clone(true));
                Dialog dialog = new Dialog();
                dialog.role = "北丑";
                dialog.type = "DIALOG";
                dialog.info = "这是你在第【" + (i + 1).ToString() + "】关【" + battle.Key + "】所获得的奖励!";

                Dialog dialog2 = new Dialog();
                dialog2.role = "主角";
                dialog2.type = "DIALOG";
                dialog2.info = "获得【" + BonusItem + "】。";

                dialogs.Add(dialog);
                dialogs.Add(dialog2);
                if (i == currentIndex)
                {
                    uiHost.dialogPanel.ShowDialogs(dialogs, (j) =>
                    {
                        uiHost.dialogPanel.CallBack = null;
                        bonusBack();
                    });
                }
            }
        }
예제 #8
0
    public void playButtonPressed()
    {
        switch (currentState)
        {
        case GameStatus.next:
            waveNumber++;
            totalEnemies += waveNumber;
            break;

        default:
            // reset everything including labels, towers on screen, total values
            totalEnemies             = 3;
            TotalEscaped             = 0;
            totalMoney               = 10;
            waveNumber               = 1;
            totalMoneyLabel.text     = TotalMoney.ToString();
            enemiesEscapedLabel.text = "Escaped : " + totalEscaped + "/10";
            currentWaveLabel.text    = "Wave " + waveNumber;
            TowerManager.getInstance().renameBuildSiteTag();
            TowerManager.getInstance().destroyAllTowers();
            audioSource.PlayOneShot(SoundManager.getInstance().NewGame);
            break;
        }
        destroyAllEnemies();
        AccessoryManager.getInstance().resetAccessoriesList();
        TotalKilled           = 0;
        RoundEscaped          = 0;
        currentWaveLabel.text = "Wave " + waveNumber;
        StartCoroutine(spawn());
        playButton.gameObject.SetActive(false);
    }
예제 #9
0
    void OnLevelWasLoaded(int level)
    {
        tower     = GameObject.Find("Tower");
        towerComp = tower.GetComponent <TowerManager>();
        // TODO: DON'T HARDCODE YOUR NAMES NICK YOU MORON
        camera        = GameObject.Find("IsoCamera");
        playerCamera  = GameObject.Find("Main Camera");
        player        = GameObject.Find("Player");
        blobbi        = GameObject.Find("Blobbi");
        shadow        = GameObject.Find("ShadowGoo");
        colorEngine   = GameObject.Find("ColorEngine");
        cloudsManager = GameObject.Find("CloudManager");
        musicHandler  = GameObject.Find("musicHandler");
//		blobbiIn = blobbiIn.GetComponent<InputField>();
//		builderIn = builderIn.GetComponent<InputField>();


        // Ignore physical collisions between the blocks and the world
        // We're doing this manually instead
        Physics.IgnoreLayerCollision(0, 8);
        // Also blocks and other blocks
        Physics.IgnoreLayerCollision(8, 8);
        scores = new List <string>();
        file   = "HighScores.txt";
        ReadScores();

        Debug.Log(builderSc[3]);
    }
예제 #10
0
 public void StartPurchase()
 {
     purchaseInProgress       = true;
     tower.purchaseInProgress = true;
     TowerManager.SetCancelButton(true, tower.typeNumber);
     SnapUnderCursor();
 }
예제 #11
0
    public void UpdateTower(TowerManager towerManager)
    {
        m_ShootAccu += Time.deltaTime;
        if (m_CurrentTarget)
        {
            if (Vector3.Distance(transform.position, m_CurrentTarget.transform.position) > m_TowerRange)
            {
                ChangeTarget();
                return;
            }

            if (CanShoot())
            {
                m_ShootAccu = 0;
                Vector3 lookDir = (new Vector3(m_CurrentTarget.transform.position.x, 0, m_CurrentTarget.transform.position.z) - transform.position).normalized;
                transform.rotation = Quaternion.LookRotation(lookDir != Vector3.zero ? lookDir : Vector3.forward);

                if (m_BulletType == BulletType.Freezing)
                {
                    m_CurrentTarget.ApplySlow(0.5f, 2.0f);
                }
                else
                {
                    var bullet = towerManager.RequestBullet(m_BulletType);
                    bullet.Shoot(transform.position, m_CurrentTarget.transform.position, m_BulletDamageAmount, m_BulletSpeed, m_ExplodeRange);
                }
            }
        }
        else
        {
            GetTarget();
        }
    }
예제 #12
0
 // Use this for initialization
 void Awake()
 {
     body.gameObject.SetActive(false);
     heroStyle.gameObject.SetActive(false);
     range.gameObject.SetActive(false);
     TowerManager.getInstance().addTower(this);
 }
예제 #13
0
 // Use this for initialization
 void Start()
 {
     towerMaster   = tower.GetComponent <TowerManager>();
     currHealth    = MAX_HEALTH;
     inRange       = false;
     currResources = 0;
 }
예제 #14
0
 void Start()
 {
     //set the class objects
             ButtonScript = GameObject.Find("Canvas/Panel").GetComponent<buttonScript>(); //get a refference to the buttonscript in scen
             towerManager = GameObject.FindGameObjectWithTag("PlayerTowerManager").GetComponent<TowerManager>();
             buildCanvas.SetActive(false);
 }
예제 #15
0
    private void CheckForTowerPlace()
    {
        int i = 5;

        if (GamePad.GetButton(GamePad.Button.X, _playerNumber))
        {
            i = 0;
        }
        if (GamePad.GetButton(GamePad.Button.A, _playerNumber))
        {
            i = 1;
        }
        if (GamePad.GetButton(GamePad.Button.B, _playerNumber))
        {
            i = 2;
        }
        if (GamePad.GetButton(GamePad.Button.Y, _playerNumber))
        {
            i = 3;
        }

        if (i <= 3 && _towers[i] != null)
        {
            GameObject temp = _towers[i];
            RemoveTower(i);
            TowerManager tM = this.Find <TowerManager>(GameTags.ScriptM);
            tM.SpawnTower(temp, _playerNumber);
        }
    }
예제 #16
0
 // Start is called before the first frame update
 void Start()
 {
     currentState = BehaviourState.Offense;
     towerManager = GameObject.Find("TowerManager").GetComponent <TowerManager>();
     target       = GameObject.Find("Red Tower").transform.position;
     unitCount    = GameObject.Find("MapManager").GetComponent <UnitCount>();
 }
예제 #17
0
    private void Start()
    {
        if (inst == null)
        {
            inst = this;
        }
        else if (inst != this)
        {
            DestroyImmediate(gameObject);
            return;
        }

        TowerUpgradeData temp = new TowerUpgradeData();

        for (int i = 0; i < towers.Length; ++i)
        {
            if (towers[i] == null)
            {
                continue;
            }
            if (!PlayerPrefs.HasKey(towers[i].TowerName))
            {
                string data = JsonUtility.ToJson(temp);
                Debug.Log("Tower Initialize ::::" + data);
                PlayerPrefs.SetString(towers[i].TowerName, data);
            }
        }


        DontDestroyOnLoad(gameObject);
    }
예제 #18
0
    public void LevelComplete()
    {
        int levelNum = Convert.ToInt32(SceneManager.GetActiveScene().name.Split('_').Last());

        LevelData levelData = new LevelData(levelNum);

        if (Money >= 100)
        {
            levelData.LevelStars[LevelData.starCondition.WinHundredMoreMoney] = true;
        }

        if (TowerManager.IsTowerOfMaxLevel())
        {
            levelData.LevelStars[LevelData.starCondition.WinAtLeastOneMaxTower] = true;
        }

        if (MaxBaseHealth == BaseHealth)
        {
            levelData.LevelStars[LevelData.starCondition.WinWithMaxBaseHealth] = true;
        }

        levelData.IsComplete = true;
        isComplete           = true;

        SaveLoadManager.SaveLevel(SceneManager.GetActiveScene().name, levelData);

        Pause();
    }
예제 #19
0
 private void Start()
 {
     tManager = TowerManager.singleTM;
     if (buildableParent.transform.position.x == buildableChild.transform.position.x)
     {
         if (buildableParent.transform.position.z > buildableChild.transform.position.z)
         {
             SetParentRotation(tManager.GetTowerRotations().minZRotation);
         }
         else
         {
             SetParentRotation(tManager.GetTowerRotations().plusZRotation);
         }
     }
     else if (buildableParent.transform.position.z == buildableChild.transform.position.z)
     {
         if (buildableParent.transform.position.x > buildableChild.transform.position.x)
         {
             SetParentRotation(tManager.GetTowerRotations().plusXRotation);
         }
         else
         {
             SetParentRotation(tManager.GetTowerRotations().minXRotation);
         }
     }
 }
예제 #20
0
        //myTeamIndex:分边确认初始位置,自己属于编组1,还是编组2。一旦load进入战斗,在自己电脑上自己总是编组1
        public void OLBattle(bool firstOLBattle, int myTeamIndex, string channel)
        {
            uihost.towerSelectRole.cancel.Visibility = Visibility.Collapsed;
            uihost.towerSelectRole.confirmBack       = () =>
            {
                foreach (int i in uihost.towerSelectRole.selectedFriends)
                {
                    uihost.towerSelectScene.cannotSelected.Add(RuntimeData.Instance.Team[i].Key);
                }

                this.uihost.Dispatcher.BeginInvoke(() =>
                {
                    Battle battle = TowerManager.getTower(uihost.towerSelectScene.currentTower)[uihost.towerSelectScene.currentIndex];
                    uihost.battleFieldContainer.LoadOLBattle(battle, uihost.towerSelectRole.selectedFriends, myTeamIndex, channel);
                });
            };

            if (firstOLBattle)
            {
                uihost.towerSelectScene.loadHuashan();
                uihost.towerSelectScene.currentTower = "江湖生死战";
                Battle battle = TowerManager.getTower(uihost.towerSelectScene.currentTower)[uihost.towerSelectScene.currentIndex];
                uihost.towerSelectScene.calcFriend(battle, myTeamIndex);
                uihost.towerSelectRole.load(uihost.towerSelectScene.maxFriendNo, null, uihost.towerSelectScene.cannotSelected);
            }
            else
            {
                uihost.towerSelectScene.currentIndex++;
                Battle battle = TowerManager.getTower(uihost.towerSelectScene.currentTower)[uihost.towerSelectScene.currentIndex];
                uihost.towerSelectScene.calcFriend(battle, myTeamIndex);
                uihost.towerSelectRole.load(uihost.towerSelectScene.maxFriendNo, null, uihost.towerSelectScene.cannotSelected);
            }
        }
예제 #21
0
        private void LoadTowerTextures()
        {
            arrowTower         = content.Load <Texture2D>("Towers\\MachineGun\\machinegun tower");
            arrowButton        = content.Load <Texture2D>("Towers\\MachineGun\\machinegun");
            arrowButtonPressed = content.Load <Texture2D>("Towers\\MachineGun\\machinegun pressed");

            spikeTower         = content.Load <Texture2D>("Towers\\Flame\\flame tower");
            spikeButton        = content.Load <Texture2D>("Towers\\Flame\\flame");
            spikeButtonPressed = content.Load <Texture2D>("Towers\\Flame\\flame pressed");

            bombTower         = content.Load <Texture2D>("Towers\\Rocket\\rocket tower");
            bombButton        = content.Load <Texture2D>("Towers\\Rocket\\rocket");
            bombButtonPressed = content.Load <Texture2D>("Towers\\Rocket\\rocket pressed");


            /// <summary> 1und1 Tower  </summary>
            oneandOneTower         = content.Load <Texture2D>("Towers\\1and1\\1and1 tower");
            oneandOneButton        = content.Load <Texture2D>("Towers\\1and1\\1and1 tower");
            oneandOneButtonPressed = content.Load <Texture2D>("Towers\\1and1\\1and1 tower");

            /// <summary> 1und1 Tower  </summary>
            ofLoveTower         = content.Load <Texture2D>("Towers\\OfLove\\oflove");
            ofLoveButton        = content.Load <Texture2D>("Towers\\OfLove\\oflove");
            ofLoveButtonPressed = content.Load <Texture2D>("Towers\\OfLove\\oflove");

            ofLoveRange = content.Load <Texture2D>("Towers\\range");

            nuclearButton = content.Load <Texture2D>("nuclear");

            arrowRange = content.Load <Texture2D>("Towers\\range");
            spikeRange = content.Load <Texture2D>("Towers\\spikeRange");

            towerManager = new TowerManager();
            towerPreview = new TowerPreview(arrowTower, Vector2.Zero, arrowRange);
        }
예제 #22
0
    /// <summary>
    /// 在消灭敌人时合成
    /// </summary>
    private void Combine()
    {
        GameObject go = Instantiate(Resources.Load(TowerManager.GetTowerFileName(CombineTarget)), transform.GetChild(1).GetChild(5)) as GameObject;

        go.transform.position = SelectedObject.transform.position;
        int MVP = 0;

        foreach (TowerManager.TowerType tt in TowerCombiningManager.CombineDic[CombineTarget])
        {
            if (tt == TowerManager.GetTowerType(SelectedObject))
            {
                continue;
            }
            foreach (GameObject t in TowerList)
            {
                if (TowerManager.GetTowerType(t) == tt)
                {
                    MVP += t.GetComponent <TowerController>().MVPLevel;
                    CreateInnerWall(t.transform.position);
                    TowerList.Remove(t);
                    Destroy(t);
                    break;
                }
            }
        }
        MVP += SelectedObject.GetComponent <TowerController>().MVPLevel;
        TowerList.Remove(SelectedObject);
        Destroy(SelectedObject);
        TowerManager.SettingTower(go.GetComponent <TowerController>(), CombineTarget);
        go.GetComponent <TowerController>().MVPLevel      = MVP < 10 ? MVP : 10;
        go.GetComponent <ClickEventHandler>().ClickEvent += TowerClickedAction;
        SelectedObject = go;
        TowerList.Add(go);
        ClearUI();
    }
예제 #23
0
    protected virtual void Init()
    {
        var gameplayManagersGO = new GameObject("GameplayManagers");

        _minionManager = gameplayManagersGO.AddComponent <MinionManager>();
        _towerManager  = gameplayManagersGO.AddComponent <TowerManager>();
        //_lvlSkillManager = gameplayManagersGO.AddComponent<LevelSkillManager>();
        _minionSkillManager = gameplayManagersGO.AddComponent <MinionsSkillManager>();
        _goSelector         = FindObjectOfType <GameObjectSelector>();
        _floorEffect        = FindObjectOfType <FloorEffect>();

        //_lvlSkillManager.level = this;
        _towerManager.level = _minionManager.level = this;

        SetGameManagerData();

        InitLevelCanvas();

        ConfigureLevelEvents();

        _gameManager.LevelInitFinished(this);
        _minionSkillManager.Init(this);

        ExecuteTutorialStep(null);
    }
    /*
     * void Update (){
     *
     *      if (Input.GetKeyUp (KeyCode.Q)){
     *              if (m_Buttonindex - 1 < 0) {
     *                      m_Buttonindex = maxButtonindex;
     *              } else {
     *                      m_Buttonindex -= 1;
     *              }
     *              OnHoverBuildButton (m_Buttonindex);
     *              m_UIBuildButton.buildButtons [m_Buttonindex].button.enabled = false;
     *      }else if(Input.GetKeyDown(KeyCode.Q)){
     *              m_UIBuildButton.OnExitBuildButton (m_UIBuildButton.buildButtons [m_Buttonindex].rootObj.gameObject);
     *              m_UIBuildButton.buildButtons [m_Buttonindex].button.enabled = true;
     *      }else if (Input.GetKeyUp (KeyCode.E)){
     *              m_UIBuildButton.OnBuildButton (m_UIBuildButton.buildButtons[m_Buttonindex].rootObj.gameObject,m_Buttonindex);
     *      }else if (Input.GetKeyUp (KeyCode.R)){
     *              m_UIBuildButton.buildButtons [m_Buttonindex].button.enabled = true;
     *              m_UIBuildButton.OnExitBuildButton (m_UIBuildButton.buildButtons [m_Buttonindex].rootObj.gameObject);
     *              m_Buttonindex = maxButtonindex;
     *              m_UIBuildButton.gameObject.SetActive (false);
     *      }
     *
     * }
     */
    public void OnBuildButton(int index)
    {
        if (index == 1)
        {
            m_Buttonindex = 2;
            m_UIBuildButton.OnExitBuildButton(m_UIBuildButton.buildButtons[2].rootObj.gameObject);
            m_UIBuildButton.buildButtons [m_Buttonindex].button.enabled = true;
            TowerManager.CreateDragNDropTower(m_TowerManager.buildableList[2]);
        }
        else
        {
            m_Buttonindex = 0;
            m_UIBuildButton.OnExitBuildButton(m_UIBuildButton.buildButtons [0].rootObj.gameObject);
            m_UIBuildButton.buildButtons [m_Buttonindex].button.enabled = true;
            TowerManager.CreateDragNDropTower(m_TowerManager.buildableList[0]);
        }



        //m_UIBuildButton.OnBuildButton (m_UIBuildButton.buildButtons[m_Buttonindex].rootObj.gameObject,m_Buttonindex);

        //UITooltip.Show (m_TowerManager.buildableList [m_Buttonindex], new Vector3 (0, 0, 0), m_Buttonindex, new Vector3 (0, 0, 0));
        //UITooltip.ShowUpgrade(m_TowerManager.buildableList [m_Buttonindex],m_Buttonindex,new Vector3 (0, 0, 0),m_Buttonindex, new Vector3 (0, 0, 0));
        //UITooltip.ShowSell (m_TowerManager.buildableList [m_Buttonindex], new Vector3 (0, 0, 0), m_Buttonindex, new Vector3 (0, 0, 0));
    }
예제 #25
0
    private void Start()
    {
        if (IsNotInCutScene())
        {
            gameMaster        = GameObject.Find("GameMaster");
            deathManager      = gameMaster.GetComponent <DeathManager>();
            pauseManager      = gameMaster.GetComponent <PauseManager>();
            soulsCounter      = gameMaster.GetComponent <SoulsCounter>();
            buildManager      = gameMaster.GetComponent <BuildManager>();
            towerManager      = gameMaster.GetComponent <TowerManager>();
            mouseCursorManage = gameMaster.GetComponent <MouseCursorManager>();
            ShopGObj          = GameObject.Find("Shop");
            if (IsInCorrectScene())
            {
                ShopGObj.SetActive(false);
                shop = ShopGObj.GetComponent <Shop>();
            }
            icosphereLight           = GetComponent <Light>();
            icosphereLight.intensity = initialIntensity;

            if (IsInCorrectScene() == false)
            {
                return;
            }
            masterTowerTowerScript = GameObject.FindWithTag("GameMaster").
                                     GetComponent <InstancesManager>().
                                     GetMasterTowerObj().
                                     GetComponent <TowerScript>();
        }
    }
예제 #26
0
 public void Awake()
 {
     manager      = GameObject.FindGameObjectWithTag("Manager").GetComponent <Manager>();
     towermanager = GameObject.FindGameObjectWithTag("TowerManager").GetComponent <TowerManager>();
     moneyManager = GameObject.FindGameObjectWithTag("MoneyManager").GetComponent <MoneyManager>();
     sellButton   = manager.SellButton;
 }
예제 #27
0
    /// <summary>
    /// Gets all necessary references.
    /// </summary>
    void Start()
    {
        photonView = this.GetComponent <PhotonView>();
        myTower    = this.GetComponent <TowerManager>();

        isMine = photonView.isMine;
    }
    /// <summary>
    /// Gets all necessary references.
    /// </summary>
    void Start()
    {
        photonView = this.GetComponent<PhotonView>();
        myTower = this.GetComponent<TowerManager>();

        isMine = photonView.isMine;
    }
예제 #29
0
    public void OnClickUp(BaseEventData eventData)
    {
        Debug.Log("OnClickUp");
        //_pTemp = ;
        //PointerEventData _PointerEventData = (PointerEventData)eventData;
        //Vector3 _p = bg.transform.InverseTransformPoint (_PointerEventData.position);
        if (clickTower != null)
        {
            clickTower.OnEndDrag(null);
            clickTower = null;
        }
        if (dragObject != null)
        {
            if (isInDrag)
            {
                ArrayList arr      = TowerManager.getInstance().getTowersList();
                bool      isChange = false;
                for (int i = 0; i < arr.Count; i++)
                {
                    Tower tower = (Tower)arr[i];
                    //if (tower.hd != null)
                    //{
                    //Image img = tower.gameObject.GetComponent<Image>();
                    float _w = Mathf.Abs(dragObject.transform.position.x - tower.transform.position.x);
                    float _h = Mathf.Abs(dragObject.transform.position.y - tower.transform.position.y);

                    if (_w < 80)
                    {
                        if (_h < 80)
                        {
                            //Vector3 _p = tower.body.transform.position;
                            //transform.position = tower.transform.position;
                            //tower.transform.SetParent (content);
                            JsonObject hd = HeroManager.getInstance().getHeroById(int.Parse(dragObject.name));

                            if (tower.isInit)
                            {
                                addHeroHead(tower.hd);
                            }
                            dragObject.transform.SetParent(null);
                            dragObject.gameObject.SetActive(false);
                            tower.initTower(hd);

                            //dragObject.transform.position = _p;
                            isChange = true;
                            break;
                        }
                    }
                    //}
                }
                if (!isChange)
                {
                    dragObject.transform.SetParent(content);
                }
            }
            isInDrag   = false;
            dragObject = null;
            //dragObject = null;
        }
    }
예제 #30
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
예제 #31
0
        public override void LoadContent()
        {
            CurrGame     = (PathDefenceGame)ScreenManager.Game;
            LevelManager = new LevelManager(CurrGame, this, levelName);
            LevelManager.Initialize();
            WaveManager = new WaveManager(CurrGame, this, levelName);
            WaveManager.Initialize();
            Background = new BackgroundGamePlayScreen(CurrGame, levelName);
            Background.Initialize();
            TowerManager = new TowerManager(CurrGame, this);
            TowerManager.Initialize();
            MoneyManager = new MoneyManager(CurrGame, this);
            MoneyManager.Initialize();
            LiveManager = new LiveManager(CurrGame, this);
            LiveManager.Initialize();
            PointsManager = new PointsManager();
            PointsManager.Initialize();

            GuiManager = new GuiManager(CurrGame, this);
            GuiManager.Initialize();
            CreepDeleteList.AddRange(CreepList);

            AddCreepList.Clear();

            CreepTimer.Start();

            gameState = EGameState.Running;
            CurrGame.IsMouseVisible = true;
            base.LoadContent();
        }
예제 #32
0
파일: Health.cs 프로젝트: NEOF/TDUnity
 // Use this for initialization
 void Start()
 {
     if (isTower)
     {
         twrMngr=this.gameObject.GetComponent("TowerManager") as TowerManager;
     }
 }
예제 #33
0
파일: Bullet.cs 프로젝트: kazik0047/Tower
 void Start()
 {
     towerManager  = FindObjectOfType <TowerManager>();
     myrigidbody2D = GetComponent <Rigidbody2D>();
     myrigidbody2D.AddForce(direction * towerManager.shootingPower);
     Destroy(gameObject, bulletLifetime);
 }
예제 #34
0
    [SerializeField] private Text sliderText = null;              //< The text next to the slider showing what value the slider is set to

    /**
     * Called before the first frame update
     */
    private void Start()
    {
        // Get references to the existing managers
        theGameManager  = FindObjectOfType <GameManager>();
        theTowerManager = FindObjectOfType <TowerManager>();
        school          = FindObjectOfType <FishSchool>();
    }
예제 #35
0
    protected virtual void Start()
    {
        mGUIManager = GameObject.Find("Main Camera").GetComponent<GUIManager>();
        mLevelManager = GameObject.Find("Main Camera").GetComponent<LevelManager>();
        mTileManager = GameObject.Find("Main Camera").GetComponent<TileManager>();
        mTowerManager = GameObject.Find("Main Camera").GetComponent<TowerManager>();

        mActive = false;
        mHover = false;
    }
예제 #36
0
	private bool isMoving;					// Boolean to check if the current block is being rotated or being switched.


	void Start ()
	{
		// Initialize blocks array.
		blocks = GameObject.FindGameObjectsWithTag ("Block");

		// Assign currentBlock to the entry at currentIndex in our blocks array.
		currentBlock = GetActiveBlock(currentIndex);

		// Get a component reference to the attached TowerManager script.
		towerScript = GetComponent<TowerManager>();
	}
예제 #37
0
    private bool ComputeTowerManager()
    {
        if (tManager==null) {
            if (TowerManager.Instance()==null) {
                GameObject towerManager = GameObject.FindGameObjectWithTag("TowerManager");
                if (towerManager!=null) {
                    tManager = towerManager.GetComponent<TowerManager>();
                }
            } else {
                tManager = TowerManager.Instance();
            }
        }

        if (tManager==null) {
            Debug.LogError("cannot find TowerManger");
            return false;
        }

        return true;
    }
예제 #38
0
    // Use this for initialization
    void Awake()
    {
        // Singleton stuff - there can only be one
        if (instance == null)
        {
            instance = this;
        } else if (instance != this) {
            Destroy(gameObject);
        }

        DontDestroyOnLoad(gameObject);
        tower = GameObject.Find("Tower").GetComponent<TowerManager>();
        //camera = GameObject.Find("Camera").GetComponent<DropperCamera>();
        player = GameObject.Find("Player");
        blobbi = GameObject.Find("Blobbi");
        shadow = GameObject.Find("ShadowGoo");
        // Ignore physical collisions between the blocks and the world
        // We're doing this manually instead
        Physics.IgnoreLayerCollision(0, 8);
        // Also blocks and other blocks
        Physics.IgnoreLayerCollision(8, 8);
    }
예제 #39
0
	private TowerManager towerScript;                 // Store a reference to our TowerManager script which will set up the level.

	void Awake() 
	{
		// Check if instance already exists
		if (instance == null)

			// If not, set instance to this
			instance = this;

		// If instance already exists and it's not this...
		else if (instance != this)

			// ...then destroy this. This inforces our singleton pattern, meaning there can only be one instance of GameManager.
			Destroy(gameObject);

		// Sets this to not be destroyed when reloading scene
		DontDestroyOnLoad(gameObject);

		// Get a component reference to the attached TowerManager script.
		towerScript = GetComponent<TowerManager>();

		// Call the InitGame function to initialize the game.
		InitGame ();
	}
예제 #40
0
 void Start()
 {
     if (floorCollider == null)
         floorCollider = GameObject.Find("Terrain").collider;
     tower = GameObject.FindObjectOfType<TowerManager>();
 }
예제 #41
0
    private TowerManager script; //TowerManager reference

    #endregion Fields

    #region Methods

    //display custom inspector
    public override void OnInspectorGUI()
    {
        //get manager reference
        script = (TowerManager)target;

        //set the targeted script modified by the GUI for handling undo
        Undo.SetSnapshotTarget(script, "Changed Settings");
        //save the current state of all objects set with SetSnapshotTarget to internal snapshot
        Undo.CreateSnapshot();

        EditorGUILayout.Space();
        EditorGUILayout.BeginHorizontal();
        GUILayout.Label("New Tower Name:");
        //tower name input
        this.newName = EditorGUILayout.TextField(this.newName);
        EditorGUILayout.EndHorizontal();

        EditorGUILayout.BeginHorizontal();
        //add a new row to config a new tower
        if (GUILayout.Button("Add Tower!"))
        {
            //don't continue if no name is set
            if (newName == null || newName == "")
            {
                Debug.LogWarning("Tower Manager: no Tower Name typed in - aborting.");
                return;
            }

            //add name to list
            script.towerNames.Add(newName);
            //add null placeholder to prefab list
            script.towerPrefabs.Add(null);
        }
        EditorGUILayout.EndHorizontal();

        EditorGUILayout.Space();
        EditorGUILayout.BeginHorizontal();
        GUILayout.Label("Sell Loss %");
        //sell loss inspector input
        script.sellLoss = EditorGUILayout.IntField(script.sellLoss);
        EditorGUILayout.EndHorizontal();

        EditorGUILayout.Space();
        EditorGUILayout.BeginHorizontal();
        GUILayout.Label("Name:");
        GUILayout.Label("Prefab:");
        EditorGUILayout.EndHorizontal();

        //don't continue if no tower is set (don't repaint inspector)
        if (script.towerNames.Count == 0) return;

        //display configurable row for each tower in inspector
        for (int i = 0; i < script.towerNames.Count; i++)
        {
            EditorGUILayout.BeginHorizontal();
            //display name ( editable text field )
            script.towerNames[i] = EditorGUILayout.TextField(script.towerNames[i]);
            //prefab slot
            script.towerPrefabs[i] = (GameObject)EditorGUILayout.ObjectField(script.towerPrefabs[i], typeof(GameObject), false);

            //button to remove the selected row
            if (GUILayout.Button("X"))
            {
                //remove this specific row - name, prefab and button texture from list
                script.towerNames.RemoveAt(i);
                script.towerPrefabs.RemoveAt(i);
            }
            EditorGUILayout.EndHorizontal();
        }

        if (GUI.changed)
        {
            //we have to tell Unity that a value of the TowerManager script has changed
            //http://unity3d.com/support/documentation/ScriptReference/EditorUtility.SetDirty.html
            EditorUtility.SetDirty(script);
            //Register the snapshot state made with CreateSnapshot so the user can later undo back to that state
            Undo.RegisterSnapshot();
            //repaint editor GUI window
            Repaint();
        }
        else
            //clear the snapshot at end of call
            Undo.ClearSnapshotTarget();
    }
예제 #42
0
    // Use this for initialization
    void Start()
    {
        tower = GameManager.instance.getTower();
        snap = tower.getSnap ();

        shape = createShape();
        tetrominoSetup();

        re = GetComponent<Renderer>();
        re.enabled = true;

        rb = GetComponent<Rigidbody>();

        if (falling == false && activated == false)
        {
            Snooze();
        }
    }
예제 #43
0
    // Use this for initialization
    void Start()
    {
        // Get the tower object
        tower = GameManager.instance.getTower();
        player = GameManager.instance.getPlayer();

        // Set the initial angle based on the camera's rotation
        initAngle = transform.eulerAngles.y;
    }
예제 #44
0
 void Start()
 {
     towerManager = GameObject.Find("_Main").GetComponent<TowerManager>();
     rend = GetComponent<Renderer>();
     defaultMaterial = rend.material;
 }
예제 #45
0
    void Start()
    {
        //set the class objects
        ButtonScript = GameObject.Find("Canvas/Panel").GetComponent<buttonScript>(); //get a refference to the buttonscript u=in scen
        canvaStatsPanel = ButtonScript.statPanel; //Should send this unit's stats to the panel
        statsLabel = canvaStatsPanel.GetComponentInChildren<Text>();

        towerManager = GameObject.FindGameObjectWithTag("PlayerTowerManager").GetComponent<TowerManager>();
        selectionCircle = transform.Find("selectPlane");
        selectionCircle.gameObject.SetActive(false);
        enemiesInRange = new List<GameObject>(); //Get alist of enemeies in range
        lastShotTime = Time.time;
        towerData = gameObject.GetComponentInChildren<TowerData>();
    }
예제 #46
0
 void Start()
 {
     timeStamp=0.0f;
     towerManager=this.gameObject.GetComponent("TowerManager") as TowerManager;
     attackAreaMelee=this.transform.GetChild(3).gameObject;
     attackAreaMeleeEnter= attackAreaMelee.GetComponent("AttackAreaEnter") as AttackAreaEnter;
 }
예제 #47
0
	// Use this for initialization
	void Start() {
		towerMaster = tower.GetComponent<TowerManager>();
		currHealth = MAX_HEALTH;
		inRange = false;
		currResources = 0;
	}
예제 #48
0
        // 对象进入场景,在这里初始化各种数据, 资源, 模型等
        // 传入数据。
        override public void OnEnterWorld()
        {
            base.OnEnterWorld();
            LoggerHelper.Info("Avatar name: " + name);
            // 在调用该函数前, 数据已经通过EntityAttach 和 EntityCellAttach 同步完毕
            CreateModel();
            inventoryManager = new InventoryManager(this);
            bodyenhanceManager = new BodyEnhanceManager(this);
            skillManager = new PlayerSkillManager(this);
            battleManger = new PlayerBattleManager(this, skillManager as PlayerSkillManager);

            doorOfBurySystem = new DoorOfBurySystem();
            runeManager = new RuneManager(this);
            towerManager = new TowerManager(this);
            missionManager = new MissionManager(this);
            taskManager = new TaskManager(this, (int)taskMain);
            marketManager = new MarketManager(this);
            friendManager = new FriendManager(this);
            operationSystem = new OperationSystem(this);
            sanctuaryManager = new SanctuaryManager(this);
            arenaManager = new ArenaManager(this);
            dailyEventSystem = new DailyEventSystem(this);
            rankManager = new RankManager(this);
            campaignSystem = new CampaignSystem(this);
            wingManager = new WingManager(this);
            rewardManager = new RewardManager(this);
            occupyTowerSystem = new OccupyTowerSystem(this);

            TipManager.Init();
            DragonMatchManager.Init();
            fumoManager = new FumoManager(this);

            MailManager.Instance.IsMailInfoDirty = true;
            TongManager.Instance.Init();
            GuideSystem.Instance.AddListeners();
            StoryManager.Instance.AddListeners();
            EventDispatcher.AddEventListener(Events.UIBattleEvent.OnNormalAttack, NormalAttack);
            EventDispatcher.AddEventListener(Events.UIBattleEvent.OnPowerChargeStart, PowerChargeStart);
            EventDispatcher.AddEventListener(Events.UIBattleEvent.OnPowerChargeInterrupt, PowerChargeInterrupt);
            EventDispatcher.AddEventListener(Events.UIBattleEvent.OnPowerChargeComplete, PowerChargeComplete);
            EventDispatcher.AddEventListener(Events.UIBattleEvent.OnSpellOneAttack, SpellOneAttack);
            EventDispatcher.AddEventListener(Events.UIBattleEvent.OnSpellTwoAttack, SpellTwoAttack);
            EventDispatcher.AddEventListener(Events.UIBattleEvent.OnSpellThreeAttack, SpellThreeAttack);
            EventDispatcher.AddEventListener(Events.UIBattleEvent.OnSpellXPAttack, SpecialAttack);
            EventDispatcher.AddEventListener<int>(Events.UIBattleEvent.OnSpriteSkill, OnSpriteSkill);

            EventDispatcher.AddEventListener<uint>(Events.GearEvent.Teleport, Teleport);
            EventDispatcher.AddEventListener<uint, int, int, int>(Events.GearEvent.Damage, SetDamage);

            EventDispatcher.AddEventListener<int, bool>(Events.InstanceEvent.InstanceLoaded, InstanceLoaded);
            EventDispatcher.AddEventListener<ushort>(Events.OtherEvent.MapIdChanged, OnMapChanged);
            EventDispatcher.AddEventListener<ulong>(Events.OtherEvent.Withdraw, Withdraw);
            EventDispatcher.AddEventListener(Events.OtherEvent.DiamondMine, DiamondMine);
            EventDispatcher.AddEventListener(Events.OtherEvent.CheckCharge, CheckCharge);
            EventDispatcher.AddEventListener(Events.OtherEvent.Charge, Charge);

            EventDispatcher.AddEventListener(ON_TASK_GUIDE, TaskGuide);
            EventDispatcher.AddEventListener(ON_END_TASK_GUIDE, EndTaskGuide);
            EventDispatcher.AddEventListener<int, int>(ON_TASK_MISSION, MissionOpen);

            EventDispatcher.AddEventListener(Events.AIEvent.DummyThink, DummyThink);
            EventDispatcher.AddEventListener(Events.StoryEvent.CGBegin, ProcCGBegin);
            EventDispatcher.AddEventListener(Events.StoryEvent.CGEnd, ProcCGEnd);
            EventDispatcher.AddEventListener<string>(Events.GearEvent.TrapBegin, ProcTrapBegin);
            EventDispatcher.AddEventListener<string>(Events.GearEvent.TrapEnd, ProcTrapEnd);
            EventDispatcher.AddEventListener(Events.GearEvent.LiftEnter, ProcLiftEnter);
            EventDispatcher.AddEventListener<int>(Events.GearEvent.PathPointTrigger, PathPointTrigger);
            EventDispatcher.AddEventListener(Events.DirecterEvent.DirActive, DirActive);

            EventDispatcher.AddEventListener<int>(Events.EnergyEvent.BuyEnergy, BuyEnergy);
            EventDispatcher.AddEventListener(ON_VIP_REAL_STATE, OnVIPRealState);

            EventDispatcher.AddEventListener<int>(Events.DiamondToGoldEvent.GoldMetallurgy, GoldMetallurgy);

            EventDispatcher.AddEventListener(MainUIDict.MainUIEvent.AFFECTUP, OnBattleBtnPressed);
            EventDispatcher.AddEventListener(MainUIDict.MainUIEvent.OUTPUTUP, OnBattleBtnPressed);
            EventDispatcher.AddEventListener(MainUIDict.MainUIEvent.MOVEUP, OnBattleBtnPressed);
            EventDispatcher.AddEventListener(MainUIDict.MainUIEvent.NORMALATTACK, OnBattleBtnPressed);
            EventDispatcher.AddEventListener(MainUIDict.MainUIEvent.PLAYERINFOBGUP, OnBattleBtnPressed);
            EventDispatcher.AddEventListener("MainUIControllStickPressed", OnBattleBtnPressed);

            EventDispatcher.AddEventListener<Vector3>(Events.GearEvent.CrockBroken, CrockBroken);
            EventDispatcher.AddEventListener<bool, bool, Vector3>(Events.GearEvent.ChestBroken, ChestBroken);

            EventDispatcher.AddEventListener<GameObject, Vector3, float>(MogoMotor.ON_MOVE_TO_FALSE, OnMoveToFalse);
            EventDispatcher.AddEventListener(Events.OtherEvent.BossDie, BossDie);

            EventDispatcher.AddEventListener<int, bool>(Events.InstanceEvent.InstanceLoaded, SetCampControl);

            timerID = TimerHeap.AddTimer<bool>(1000, 100, SyncPos, true);
            checkDmgID = TimerHeap.AddTimer(0, 1000, CheckDmgBase);
            syncHpTimerID = TimerHeap.AddTimer(10000, 5000, SyncHp);
            skillFailoverTimer = TimerHeap.AddTimer(1000, 3000, SkillFailover);
            TimerHeap.AddTimer(5000, 0, GetServerTickReq);
            //rateTimer = TimerHeap.AddTimer(1000, 3000, CheckRate);
            CheckCharge();
            GetWingBag();
            MogoTime.Instance.InitTimeFromServer();

            MogoUIManager.Instance.LoadUIResources();
            TimerHeap.AddTimer(500, 0, EventDispatcher.TriggerEvent, Events.RuneEvent.GetBodyRunes);
            TimerHeap.AddTimer(500, 0, marketManager.GiftRecordReq);

            if (IsNewPlayer)
            {
                CurMissionID = 10100;
                CurMissionLevel = 1;

                missionManager.EnterMissionReq(CurMissionID, CurMissionLevel);
            }


            if (PlatformSdkManager.Instance)
                TimerHeap.AddTimer(1000, 60000, PlatformSdkManager.Instance.OnSetupNotification);
        }
예제 #49
0
    void OnLevelWasLoaded(int level)
    {
        tower = GameObject.Find("Tower");
        towerComp = tower.GetComponent<TowerManager>();
        // TODO: DON'T HARDCODE YOUR NAMES NICK YOU MORON
        camera = GameObject.Find("IsoCamera");
        playerCamera = GameObject.Find("Main Camera");
        player = GameObject.Find("Player");
        blobbi = GameObject.Find("Blobbi");
        shadow = GameObject.Find("ShadowGoo");
        colorEngine = GameObject.Find("ColorEngine");
        cloudsManager = GameObject.Find("CloudManager");
        musicHandler = GameObject.Find("musicHandler");
        //		blobbiIn = blobbiIn.GetComponent<InputField>();
        //		builderIn = builderIn.GetComponent<InputField>();

        // Ignore physical collisions between the blocks and the world
        // We're doing this manually instead
        Physics.IgnoreLayerCollision(0, 8);
        // Also blocks and other blocks
        Physics.IgnoreLayerCollision(8, 8);
        scores = new List<string>();
        file = "HighScores.txt";
        ReadScores ();

        Debug.Log(builderSc[3]);
    }
예제 #50
0
 // Use this for initialization
 void Start()
 {
     tower = transform.parent.GetComponent<TowerManager>();
     tower.RowAdded += (sender, e) => UpdateCenter();
     UpdateCenter();
 }
예제 #51
0
    void Awake()
    {
        rButton = false;

        buttonList = new List<GameObject>();
        towerMngr = GameObject.Find("gameManager").GetComponent<TowerManager>() as TowerManager;
        gameMngr = GameObject.Find("gameManager").GetComponent<GameManager>() as GameManager;
        bulletHolder = GameObject.Find("bullets");
        itemLenght = items.Count;

        screenHeight = 2f * Camera.main.orthographicSize;
        screenWidth = screenHeight * Camera.main.aspect;
        topRight = new Vector3( screenWidth/2, screenHeight/2,10);
        itemDisplasment = new Vector3( -0.2f, -0.2f,0);

        for ( int i = 0; i < itemLenght; i++){
            CreateButton(i);
        }
        setItem(itemLenght-1);
        currentItem = itemLenght-1;

        //create line
        lineRenderer = gameObject.AddComponent<LineRenderer>();
        lineRenderer.SetColors(lineColor1, lineColor2);
        lineRenderer.SetWidth(linewidth1, linewidth2);
        lineRenderer.SetVertexCount(lengthOfLineRenderer);
        lineRenderer.material = new Material (Shader.Find("Particles/Additive"));
        lineRenderer.enabled = false;
        lineRenderer.sortingLayerName = "player";
        lineRenderer.sortingOrder = 11;

        //create tower sell text
        towerSellTextHolder = GameObject.Instantiate(towerSellTextPrefab,transform.position,Quaternion.identity) as GameObject;
        //towerSellTextHolder.name = "towerSellText";
        towerSellTextRender = towerSellTextHolder.GetComponent<MeshRenderer>();
        towerSellText = towerSellTextHolder.GetComponent<TextMesh>();
        towerSellTextRender.sortingLayerName = "ui";
        //towerSellText.font = TowerSellFont;
        towerSellText.text = "TowerSellText";
        towerSellTextHolder.SetActive(false);

        //create noIcon
        noIconHolder = GameObject.Instantiate(noIcon,transform.position,Quaternion.identity) as GameObject;
        noIconHolder.SetActive(false);
    }
예제 #52
0
    void Start()
    {
        mTowerManager = GameObject.Find("Main Camera").GetComponent<TowerManager>();
        mLevelManager = GameObject.Find("Main Camera").GetComponent<LevelManager>();
        mGUIManager = GameObject.Find("Main Camera").GetComponent<GUIManager>();
        mTileManager = GameObject.Find("Main Camera").GetComponent<TileManager>();

        mTileActive = false;
        mTempo = false;
        mClick = false;
        mHover = false;

        mUpgradedTower = false;
    }
예제 #53
0
 public TowerStateChangedEventArgs(TowerManager.TowerState state, bool isWaiting)
 {
     this.state = state;
     this.isWaiting = isWaiting;
 }
예제 #54
0
    void Start()
    {
        mLevelManager = gameObject.GetComponent<LevelManager>();
        mTowerManager = gameObject.GetComponent<TowerManager>();

        mTowerIconsList = new List<GameObject>();

        for (int i = 0; i < towerIconList.Count; i++)
            mTowerIconsList.Add(Instantiate(towerIconList[i]) as GameObject);

        mCloseButton = Instantiate(closeButton) as GameObject;
        mCloseButton.active = false;
        mBuyButton = Instantiate(buyButton) as GameObject;
        mBuyButton.active = false;
        mSellButton = Instantiate(sellButton) as GameObject;
        mSellButton.active = false;
        mUpgradeButton = Instantiate(upgradeButton) as GameObject;
        mUpgradeButton.active = false;

        mUpgradeMenuActive = false;

        mType = GameObject.Instantiate(type) as GameObject;
        mType.GetComponent<TextMesh>().text = " ";

        mCurrent = GameObject.Instantiate(current) as GameObject;
        mCurrent.GetComponent<TextMesh>().text = " ";

        mUpgrade = GameObject.Instantiate(upgrade) as GameObject;
        mUpgrade.GetComponent<TextMesh>().text = " ";

        mUpgradeValue = GameObject.Instantiate(upgradeValue) as GameObject;
        mUpgradeValue.GetComponent<TextMesh>().text = " ";

        mSellValue = GameObject.Instantiate(sellValue) as GameObject;
        mSellValue.GetComponent<TextMesh>().text = " ";

        mTextRight = GameObject.Instantiate(textRight) as GameObject;
        mTextRight.GetComponent<TextMesh>().text = " ";

        mCurrentIcon = null;
        mCurrentUpgradeIcon = null;

        mTextRight.GetComponent<TextMesh>().text =
            "Level:" + mLevelManager.GetLevelNumber() +
            "\nBank:" + mLevelManager.GetBank();
    }
 // Use this for initialization
 void Start()
 {
     ButtonScript = GameObject.Find("Canvas/Panel").GetComponent<buttonScript>(); //get a refference to the buttonscript u=in scen
     canvaStatsPanel = ButtonScript.statPanel;
     selectManager = GameObject.FindGameObjectWithTag("PlayerTowerManager").GetComponent<TowerManager>();
 }
    /// <summary>
    /// Initializes AI. Gets all references, and starts moving.
    /// </summary>
    public void StartAI()
    {
        playerManager = this.GetComponent<PlayerManager>();
        myProperties = this.GetComponent<PlayerProperties>();
        navMeshAgent = this.GetComponent<NavMeshAgent>();

        navMeshAgent.speed = myProperties.actualMovSpd;

        controlledLocally = true;

        this.FindNewPoint();

        gamePanels = GameController.instance.GetGamePanels();

        int enemyID = playerManager.myTeam.GetHashCode();
        enemyID++;
        if (enemyID > TeamTypes.Orange.GetHashCode())
        {
            enemyID = 0;
        }

        enemyTeam = (TeamTypes)enemyID;
        enemyTower = GameController.instance.GetTower(enemyTeam);

        enemies = GameController.instance.GetPlayersOfTeam(enemyTeam);
    }
예제 #57
0
    // Use this for initialization
    void Start()
    {
        // Get the tower object
        tower = GameManager.instance.getTower();

        // Set the initial angle based on the camera's rotation
        initAngle = transform.eulerAngles.y;

        Camera camera = (Camera)GetComponent<Camera>();

        // Makes the map fit in the camera
        camera.orthographicSize = Mathf.Max(tower.maxX - tower.minX, tower.maxZ - tower.minZ) - 1f;

        transform.position = new Vector3(tower.transform.position.x - (tower.mapXSize/2), 9f, tower.transform.position.z - (tower.mapZSize/2));
        maxDistAboveTower = camera.orthographicSize;
    }
예제 #58
0
 void Awake()
 {
     s_Singleton = this;
 }
    /// <summary>
    /// Start method. Gets all references.
    /// </summary>
    public void StartPlayer(bool playerControlled, TeamTypes myTeam, string playerPlayFabID, string playFabName)
    {
        this.playerPlayFabID = playerPlayFabID;
        this.myTeam = myTeam;
        this.playerControlled = playerControlled;
        this.playerPlayFabName = playFabName;

        myProperties = this.GetComponent<PlayerProperties>();
        networkLayer = this.GetComponent<PlayerNetworkLayer>();
        animationManager = this.GetComponent<PlayerAnimationManager>();
        shooterManager = this.GetComponent<ShooterManager>();
        aiManager = this.GetComponent<PlayerAIManager>();

        shooterManager.CreateBuffer(myTeam);

        myTower = GameController.instance.GetTower(myTeam);

        playerExp = playerLevel = 0;

        myProperties.Initialize();

        baseSprite.color = spriteTeamColors[myTeam.GetHashCode()];

        Debug.Log("initializing player. is human? " + playerControlled+" is local? "+networkLayer.isMine);
        if (networkLayer.isMine)
        {
            if (playerControlled)
            {
                Camera.main.transform.SetParent(this.transform, true);

                //levelText = GameController.instance.GetLevelText();
                expText = GameController.instance.GetExpText();

                GameplayUI.instance.Initialize(myTeam,this);
                GameplayUI.instance.UpdateSidebarStats(myProperties);

                InGameStoreAndCurrencyManager.instance.SetUpgradesCallbacks(new ProjectDelegates.OnPlayerBoughtStatUpgradeCallback[]{
                    myProperties.IncreaseAtk,myProperties.IncreaseMovSpd,myProperties.IncreaseHP
                });
            }

            this.transform.position = GameController.instance.GetRandomSpawnPoint(myTeam);
        }
    }