Esempio n. 1
0
    protected override void FormatData()
    {
        if (photonView.isMine)
        {
            SceneManager.AddMy_Electricity(this);
            if (originalTurretData.ATK_Level != TurretData.myTowerAtkLevel || originalTurretData.DEF_Level != TurretData.myTowerDefLevel)
            {
                originalTurretData = TurretData.instance.getTowerData(DataName);
            }

            //取得第一波網格
            tmpCollider = Physics.OverlapBox(transform.position, rangeV3, Quaternion.identity, GridMask);
            if (tmpCollider.Length != 0)
            {
                for (int i = 0; i < tmpCollider.Length; i++)
                {
                    if (Vector3.SqrMagnitude(tmpCollider[i].transform.position - transform.position) <= range * range)
                    {
                        tmpCollider[i].gameObject.layer = 25;
                        gridMeshList.Add(tmpCollider[i].GetComponent <MeshRenderer>());
                    }
                }
            }
        }
        else
        {
            SceneManager.AddEnemy_Electricity(this);
            if (originalTurretData.ATK_Level != TurretData.enemyTowerAtkLevel || originalTurretData.DEF_Level != TurretData.enemyTowerDefLevel)
            {
                originalTurretData = TurretData.instance.getEnemyTowerData(DataName);
            }
        }
        turretData = originalTurretData;
        deadManager.ifDead(false);
        turretData.UI_Hp             = turretData.UI_maxHp;
        turretData.Fad_thermalEnergy = 0;

        healthBar.fillAmount     = 1;
        Fad_energyBar.fillAmount = 0.0f;
        resource_Electricity     = (int)originalTurretData.Atk_Damage;
        electricity = resource_Electricity;
        _mytouch    = -1;
    }