Esempio n. 1
0
        public void AddBuildModule(AbstractBuildConfig config, bool calculate = false)
        {
            if (config == null)
            {
                return;
            }

            buildModules.Add(config);
            config.App(uid, this, calculate);

            switch (config.buildModuleType)
            {
            case BuildModuleType.Produce:
                lastBuildProduceConfig = (BuildProduceConfig)config;
                build_produce          = true;
                break;

            case BuildModuleType.Turret:
                lastBuildTurretConfig = (BuildTurretConfig)config;
                build_turret          = true;
                break;

            case BuildModuleType.Spot:
                lastBuildSpotConfig = (BuildSpotConfig)config;
                build_spot          = true;
                break;
            }
        }
Esempio n. 2
0
        public void RemoveBuildModule(AbstractBuildConfig config, bool calculate = false)
        {
            if (config == null)
            {
                return;
            }

            buildModules.Remove(config);
            config.Revoke(uid, this, calculate);

            switch (config.buildModuleType)
            {
            case BuildModuleType.Produce:
                if (lastBuildProduceConfig == config)
                {
                    lastBuildProduceConfig = null;
                    build_produce          = false;
                }
                break;

            case BuildModuleType.Turret:
                if (lastBuildTurretConfig == config)
                {
                    lastBuildTurretConfig = null;
                    build_turret          = false;
                }
                break;

            case BuildModuleType.Spot:
                if (lastBuildSpotConfig == config)
                {
                    lastBuildSpotConfig = null;
                    build_spot          = false;
                }
                break;
            }
        }
Esempio n. 3
0
        IEnumerator Check()
        {
            while (runing)
            {
                yield return(new WaitForSeconds(1f));

                if (!War.isGameing)
                {
                    continue;
                }

                if (buildSpotConfig != unitData.lastBuildSpotConfig)
                {
                    buildSpotConfig = unitData.lastBuildSpotConfig;

                    if (_buildSpotConfig == null && buildSpotConfig != null && _legionId == War.ownLegionID)
                    {
                        isMsg = true;
                    }

                    if (buildSpotConfig != null)
                    {
                        isEffect = true;
                    }

                    _buildSpotConfig = buildSpotConfig;
                }

                if (buildSpotConfig != null && _legionId != unitData.legionId)
                {
                    _legionId = unitData.legionId;

                    isEffect = true;

                    if (_legionId == War.ownLegionID)
                    {
                        isMsg = true;
                    }
                }

                if (isFirst)
                {
                    isEffect = false;
                    isMsg    = false;
                    isFirst  = false;
                }

                if (isMsg)
                {
                    War.textEffect.PlaySpot(buildSpotConfig.spotType, transform);
                    isMsg = false;
                }


                if (isEffect)
                {
                    GameObject go = War.pool.spotChange.Get();
                    go.transform.position = transform.position;
                    go.GetComponent <SpotChangeEffect>().SetColorId(legionData.colorId);
                    go.SetActive(true);
                    isEffect = false;
                }
            }
        }
Esempio n. 4
0
 public void AddBuildSpotConfig(BuildSpotConfig config)
 {
     buildSpotConfigs.Add(config.id, config);
 }