Exemplo n.º 1
0
 public void Damage(TowersAI m_Towers)
 {
     if (!m_Towers.isDamageAOE)
     {
         Damage(m_Towers.damage);
     }
     else
     {
         Damage(m_Towers.damage / 2);
     }
 }
Exemplo n.º 2
0
    public void BuildTwoTower()
    {
        if (CurrentMouseMode == MouseMode.ChooseBld)
        {
            BuildTowers(TowersType.two, priceTwoTower);
        }
        else if (CurrentMouseMode == MouseMode.Upgrade)
        {
            if (m_TowersAI.towerLevel < 2)
            {
                if (m_GUIManager.SubtractRepairParts(priceTowerUP))
                {
                    m_TowersAI.towerLevel++;

                    switch (m_TowersAI.thisTower)
                    {
                    case TowersAI.TowersType.one:
                        tempGO = Instantiate(TowersGOOne[m_TowersAI.towerLevel]);
                        break;

                    case TowersAI.TowersType.two:
                        tempGO = Instantiate(TowersGOTwo[m_TowersAI.towerLevel]);
                        break;

                    case TowersAI.TowersType.three:
                        tempGO = Instantiate(TowersGOThree[m_TowersAI.towerLevel]);
                        break;
                    }

                    TowersAI towAI = tempGO.GetComponent <TowersAI>();
                    towAI.damage     = m_TowersAI.damage;
                    towAI.towerLevel = m_TowersAI.towerLevel;
                    towAI.radius     = m_TowersAI.radius;

                    AllBuildTowers.Add(tempGO);
                    AllBuildTowers[AllBuildTowers.Count - 1].transform.position = upgradeTower.transform.position;

                    AllBuildTowers.Remove(upgradeTower);
                    Destroy(upgradeTower);

                    HideBuildCursor();
                }
                else
                {
                    m_GUIManager.ShowToolTip("Мало запасных частей. Надо ещё - " + (priceTowerUP - repairPartsCount).ToString(), true);
                }
            }
            else
            {
                m_GUIManager.ShowToolTip("Башня максимального уровня.", false);
            }
        }
    }
Exemplo n.º 3
0
    private void MouseEmptyMode()
    {
        if (Input.GetMouseButtonDown(0))
        {
            m_Ray = m_Camera.ScreenPointToRay(new Vector3(Input.mousePosition.x, Input.mousePosition.y, 0));

            if (Physics.Raycast(m_Ray, out hit, rayDistance))
            {
                if (hit.transform.gameObject.tag == "Towers")
                {
                    upgradeTower = hit.transform.parent.gameObject;
                    m_TowersAI   = upgradeTower.GetComponent <TowersAI>();

                    ChangeMouseMode(MouseMode.Upgrade);
                }
                else
                {
                    ChangeMouseMode(MouseMode.Build);
                }
            }
        }
    }
Exemplo n.º 4
0
    public virtual void Initialized(TowersAI tAI)
    {
        m_TowersAI = tAI;

        targetTransform = m_TowersAI.target;
        targetPawn      = m_TowersAI.targetPawn;

        m_BehaviorTree.enabled = true;

        if (!m_TowersAI.isDamageAOE)
        {
            m_BehaviorTree.SetVariableValue("Target", targetTransform.gameObject);
        }
        else
        {
            tempGO    = new GameObject();
            direction = new Vector3(targetTransform.position.x, -0.5f, targetTransform.position.z);
            tempGO.transform.position = direction;
            m_BehaviorTree.SetVariableValue("Target", tempGO);

            LeanTween.rotateAround(gameObject, Vector3.up, 180, 1.0f);
            LeanTween.rotateAround(gameObject, Vector3.left, 180, 1.2f);
        }
    }
Exemplo n.º 5
0
 public override void Initialized(TowersAI tAI)
 {
 }