Beispiel #1
0
    public TowerStatus(Tower tower, int floorIndex, TowerBaseInfo info, bool isMaxLevelSet = false)
    {
        this.tower      = tower;
        this.towerObj   = tower.transform;
        this.table      = info.GetTable();
        this.floorIndex = floorIndex;

        this.enchantLevel = info.enchantLevel;

        this.attackSpeed = table.attackSpeed;
        this.attackRange = table.attackRange;

        this.buffList = new List <BuffParam>();

        if (TowerAddValueTable.Instance != null &&
            TowerAddValueTable.Instance.FindTable(table.id, out addValueTableList))
        {
            this.level = isMaxLevelSet ? addValueTableList.Count - 1 : 0;

            this.curDamage  = table.damage + addValueTableList[Mathf.Clamp(this.level, 0, addValueTableList.Count - 1)].addDamageValue;
            this.curDamage += Mathf.RoundToInt(this.curDamage * this.enchantLevel * TowerAddValueTable.ENCHANT_ADD_FACTOR);
        }

        if (EffectTable.Instance != null)
        {
            EffectTable.Instance.FindTable(info.GetTable().attackEffectID, out effectTable);
        }

        towerObj.localRotation = (floorIndex.Equals(0) || (floorIndex % 2).Equals(0)) ?
                                 Quaternion.Euler(Vector3.up * -180.0f) : Quaternion.Euler(Vector3.zero);

        this.curTargetEnemy = null;
    }
    public TowerIngame(TowerBaseInfo data)
    {
        Name        = data.Name;
        Cost        = data.Cost;
        Description = data.Description;

        Attitudes           = data.Attitudes;
        LevelIndexAttitudes = new List <CoupleValue>();

        FindAttitude();
    }
Beispiel #3
0
    public void InitModel(TowerBaseInfo info, bool isPlay = true)
    {
        if (gameObject.activeSelf == false)
        {
            gameObject.SetActive(true);
        }

        StopAllCoroutines();

        gameObject.transform.localPosition = Vector3.zero;
        status = new TowerStatus(this, 0, info, true);

        SetAtlas();
        if (isPlay && spriteAnimator != null)
        {
            spriteAnimator.PlayAnimation(eAnimationType.Type_Lobby_Idle, null);
        }
    }
Beispiel #4
0
    public void Init(TowerPlaceToken token, TowerBaseInfo info)
    {
        if (gameObject.activeSelf == false)
        {
            gameObject.SetActive(true);
        }

        StopAllCoroutines();

        gameObject.transform.localPosition = token.obj.transform.localPosition;
        status = new TowerStatus(this, token.FloorIndex, info);

        SetAtlas();

        if (TowerManager.Instance != null)
        {
            TowerManager.Instance.AddTowerList(this);
        }

        StartCoroutine("AttackMode");
    }
Beispiel #5
0
    // Use this for initialization
    void Start()
    {
        _instance = this;

        uiManager = GameObject.Find("UI").GetComponent <UIManager> ();                               //1V1 or 3V3
        if (uiManager.mapSelect == MapSelect.oneVSone)
        {
            camp           = Scence1v1_Intialize.Instance.playerCamp;
            roleMains_Red  = new Role_Main[1];
            roleMains_Blue = new Role_Main[1];
            roles_Red      = new Record_Role[1];
            roles_Blue     = new Record_Role[1];
            if (camp == Role_Camp.Red)
            {
                roleMains_Red [0]  = Scence1v1_Intialize.Instance.role_Player.GetComponent <Role_Main> ();
                roleMains_Blue [0] = Scence1v1_Intialize.Instance.role_AI.GetComponent <Role_Main> ();
            }
            if (camp == Role_Camp.Blue)
            {
                roleMains_Red [0]  = Scence1v1_Intialize.Instance.role_AI.GetComponent <Role_Main> ();
                roleMains_Blue [0] = Scence1v1_Intialize.Instance.role_Player.GetComponent <Role_Main> ();
            }
        }
        if (uiManager.mapSelect == MapSelect.threeVSthree)
        {
            camp           = Scence3v3_Intialize.Instance.playerCamp;
            roleMains_Red  = new Role_Main[3];
            roleMains_Blue = new Role_Main[3];
            roles_Red      = new Record_Role[3];
            roles_Blue     = new Record_Role[3];
            if (camp == Role_Camp.Red)
            {
                for (int i = 0; i < Scence3v3_Intialize.Instance.role_Players.Length; i++)
                {
                    roleMains_Red [i]  = Scence3v3_Intialize.Instance.role_Players [i].GetComponent <Role_Main> ();
                    roleMains_Blue [i] = Scence3v3_Intialize.Instance.role_AIs [i].GetComponent <Role_Main> ();
                }
            }
            if (camp == Role_Camp.Blue)
            {
                for (int i = 0; i < Scence3v3_Intialize.Instance.role_AIs.Length; i++)
                {
                    roleMains_Red [i]  = Scence3v3_Intialize.Instance.role_AIs [i].GetComponent <Role_Main> ();
                    roleMains_Blue [i] = Scence3v3_Intialize.Instance.role_Players [i].GetComponent <Role_Main> ();
                }
            }
        }



        towerBlue = GameObject.Find("shuiJingBlue").GetComponent <TowerBaseInfo>();
        towerRed  = GameObject.Find("shuiJingRed").GetComponent <TowerBaseInfo> ();
        CanOver   = false;
        cam       = Camera.main.transform;
        redPos    = GameObject.Find("shuiJingRed").transform;
        bluePos   = GameObject.Find("shuiJingBlue").transform;

        obj_win    = GameObject.Find("UI/gameOverShow/win");
        obj_lose   = GameObject.Find("UI/gameOverShow/lose");
        obj_button = GameObject.Find("UI/gameOverShow/gameover");
        obj_win.SetActive(false);
        obj_lose.SetActive(false);
        obj_button.SetActive(false);
    }