public PropsData(string _name, int _id, PropsType _pType, string _name_cn) { name = _name; id = _id; pType = _pType; name_cn = _name_cn; }
private void PreloadProps(PropsType propsType) { object functionData = ConfigInterface.Instance.PropsConfigHelper.GetPropsData(propsType).FunctionConfigData; if (functionData is PropsScopeConfigData || functionData is PropsArmyConfigData || functionData is PropsMercenaryConfigData || functionData is PropsTargetConfigData) { AttackPropsConfigWrapper configWrapper = new AttackPropsConfigWrapper(functionData); string prefabPath = string.Format("{0}{1}{2}", ClientStringConstants.BATTLE_SCENE_RESOURCE_PREFAB_PREFIX_NAME, ClientStringConstants.ATTACK_PROPS_PREFAB_PREFIX_NAME, configWrapper.PrefabName); GameObject propsPrefab = Resources.Load(prefabPath) as GameObject; if (!this.m_PreloadPropsPrefab.ContainsKey(propsType)) { this.m_PreloadPropsPrefab.Add(propsType, propsPrefab); } if (functionData is PropsArmyConfigData) { this.PreloadArmy(((PropsArmyConfigData)functionData).ArmyType, ((PropsArmyConfigData)functionData).Level); } if (functionData is PropsMercenaryConfigData) { this.PreloadMercenary(((PropsMercenaryConfigData)functionData).MercenaryType); } } }
/// <summary> /// 播放对应的特效 /// </summary> private void ShowPropsEffects(GameObject go) { PropsType type = go.GetComponent <PropsBase>().PropsType; switch (type) { case PropsType.Cure: effectMesg.Change(this.gameObject, EffectType.CureEffect); Dispatch(AreaCode.EFFECT, EffectsEvents.SHOW_EFFECTS, effectMesg); break; case PropsType.Food: effectMesg.Change(this.gameObject, EffectType.FoodEffect); Dispatch(AreaCode.EFFECT, EffectsEvents.SHOW_EFFECTS, effectMesg); break; case PropsType.Arms: effectMesg.Change(this.gameObject, EffectType.ArmsEffect); Dispatch(AreaCode.EFFECT, EffectsEvents.SHOW_EFFECTS, effectMesg); break; default: break; } }
public void ConstructDefenseObject(PropsType type, TilePosition position) { PropsDefenseScopeConfigData scopeConfigData = ConfigInterface.Instance.PropsConfigHelper.GetPropsData(type).FunctionConfigData as PropsDefenseScopeConfigData; PropsDefenseScopeLastingConfigData lastingConfigData = ConfigInterface.Instance.PropsConfigHelper.GetPropsData(type).FunctionConfigData as PropsDefenseScopeLastingConfigData; string p = scopeConfigData != null ? scopeConfigData.PrefabName : lastingConfigData.PrefabName; List <TilePoint> buildingObstacleList = scopeConfigData != null ? scopeConfigData.BuildingObstacleList : lastingConfigData.BuildingObstacleList; string prefabName = string.Format("{0}{1}{2}", ClientStringConstants.BATTLE_SCENE_RESOURCE_PREFAB_PREFIX_NAME, ClientStringConstants.DEFENSE_OBJECT_PREFAB_PREFIX_NAME, p); GameObject objectPrefab = Resources.Load(prefabName) as GameObject; GameObject newObject = GameObject.Instantiate(objectPrefab) as GameObject; GameObject.DestroyImmediate(newObject.GetComponent <DefenseObjectAI>()); EditorDefenseObjectBehavior objectBehavior = newObject.AddComponent <EditorDefenseObjectBehavior>(); objectBehavior.Position = position; objectBehavior.PropsType = type; newObject.transform.position = PositionConvertor.GetWorldPositionByBuildingTileIndex(position); newObject.transform.parent = this.m_SceneParent; this.PopulateMapData(position, buildingObstacleList, newObject); }
public void UseProps(PropsType propsType, Vector3 position) { //AudioController.Play("PutdownSoldier"); object functionData = ConfigInterface.Instance.PropsConfigHelper.GetPropsData(propsType).FunctionConfigData; GameObject propsPrefab = this.m_PreloadManager.GetPropsPrefab(propsType); GameObject props = GameObject.Instantiate(propsPrefab) as GameObject; props.transform.position = position; props.transform.parent = this.m_BulletParent; AttackPropsBehavior propsBehavior = props.GetComponent <AttackPropsBehavior>(); propsBehavior.ParentNode = BattleObjectCache.Instance.RuinsObjectParent.transform; if (functionData is PropsScopeConfigData) { PropsScopeConfigData propsScopeConfigData = functionData as PropsScopeConfigData; AttackScopeDamageBehavior scopeBehavior = props.GetComponent <AttackScopeDamageBehavior>(); scopeBehavior.AttackCategory = propsScopeConfigData.AttackCategory; scopeBehavior.Damage = propsScopeConfigData.Effect; scopeBehavior.Scope = propsScopeConfigData.Scope; scopeBehavior.TotalTimes = propsScopeConfigData.TotalTimes; scopeBehavior.IntervalTicks = propsScopeConfigData.IntervalTicks; } else if (functionData is PropsArmyConfigData) { PropsArmyConfigData propsArmyConfigData = functionData as PropsArmyConfigData; AttackArmyBehavior armyBehavior = props.GetComponent <AttackArmyBehavior>(); armyBehavior.ArmyType = propsArmyConfigData.ArmyType; armyBehavior.ArmyLevel = propsArmyConfigData.Level; armyBehavior.IntervalTicks = propsArmyConfigData.IntervalTicks; armyBehavior.TotalTimes = propsArmyConfigData.TotalTimes; armyBehavior.Number = propsArmyConfigData.Number; armyBehavior.CharacterFactory = this; } else if (functionData is PropsMercenaryConfigData) { PropsMercenaryConfigData propsMercenaryConfigData = functionData as PropsMercenaryConfigData; AttackMercenaryBehavior mercenaryBehavior = props.GetComponent <AttackMercenaryBehavior>(); mercenaryBehavior.MercenaryType = propsMercenaryConfigData.MercenaryType; mercenaryBehavior.IntervalTicks = propsMercenaryConfigData.IntervalTicks; mercenaryBehavior.TotalTimes = propsMercenaryConfigData.TotalTimes; mercenaryBehavior.Number = propsMercenaryConfigData.Number; mercenaryBehavior.CharacterFactory = this; } else if (functionData is PropsTargetConfigData) { PropsTargetConfigData propsTargetConfigData = functionData as PropsTargetConfigData; AttackTargetBehavior targetBehavior = props.GetComponent <AttackTargetBehavior>(); targetBehavior.Scope = propsTargetConfigData.Scope; targetBehavior.LastingTicks = propsTargetConfigData.LastingTicks; AttackTargetHPBehavior hpBehavior = props.GetComponent <AttackTargetHPBehavior>(); hpBehavior.TotalHP = propsTargetConfigData.HP; hpBehavior.ArmorCategory = propsTargetConfigData.ArmorCategory; } }
/// <summary> /// 道具基类的构造函数 /// </summary> public Props(int id, string name, PropsType propsType, PropRarity propRarity, string description, int capacity, string propSprite) { Id = id; Name = name; PropsType = propsType; PropRarity = propRarity; Description = description; Capacity = capacity; PropSprite = propSprite; }
public void ConstructDefenseObject(PropsType type) { PropsDefenseScopeConfigData scopeConfigData = ConfigInterface.Instance.PropsConfigHelper.GetPropsData(type).FunctionConfigData as PropsDefenseScopeConfigData; PropsDefenseScopeLastingConfigData lastingConfigData = ConfigInterface.Instance.PropsConfigHelper.GetPropsData(type).FunctionConfigData as PropsDefenseScopeLastingConfigData; List <TilePoint> buildingObstacleList = scopeConfigData != null ? scopeConfigData.BuildingObstacleList : lastingConfigData.BuildingObstacleList; TilePosition centerPosition = PositionConvertor.GetBuildingTileIndexFromWorldPosition(this.m_SceneCamare.position); TilePosition position = this.FindValidBuildingPosition(centerPosition, buildingObstacleList); if (position != null) { this.ConstructDefenseObject(type, position); } }
private void AddPropsIcon(PropsType propsType) { GameObject propsObject = GameObject.Instantiate(this.m_TrophyPropsPrefab) as GameObject; UISprite propsSprite = propsObject.GetComponent <UISprite>(); propsSprite.spriteName = ConfigInterface.Instance.PropsConfigHelper. GetPropsData(propsType).PrefabName; propsObject.transform.parent = this.m_TrophyPropsParent; propsSprite.MakePixelPerfect(); string order = this.m_PropsIndex < 10 ? "0" + this.m_PropsIndex : this.m_PropsIndex.ToString(); propsObject.name = order + "_" + propsObject.name; this.m_PropsIndex++; }
public void GenerateProps(int propsNo, PropsType propsType) { PropsData data = new PropsData(); PropsConfigData configData = ConfigInterface.Instance.PropsConfigHelper.GetPropsData(propsType); data.PropsNo = propsNo; data.RemainingUseTime = configData.MaxUseTimes; data.RemainingCD = configData.CD; data.PropsConfigData = configData; data.PropsType = propsType; data.IsInBattle = false; PropsLogicObject logicObject = new PropsLogicObject(data); this.m_Props.Add(propsNo, logicObject); }
//Popup Button message void OnRepairBuilidng() { if (this.AchievementBuildingLogicData.Life >= this.AchievementBuildingLogicData.MaxLife) { return; } AchievementBuildingConfigData achievementBuildingConfigData = ConfigInterface.Instance.AchievementBuildingConfigHelper.GetAchievementBuildingData(this.AchievementBuildingLogicData.AchievementBuildingType); PropsType propsType = achievementBuildingConfigData.NeedPropsType; int currentPropsCount = LogicController.Instance.AllProps.Count(a => a.PropsType == propsType && a.RemainingCD <= 0); if (currentPropsCount > 0) { LogicController.Instance.RepairAchievementBuilding(this.AchievementBuildingLogicData.BuildingNo); } else { UIErrorMessage.Instance.ErrorMessage(39, this.AchievementBuildingLogicData.Name, achievementBuildingConfigData.Name); } }
void SpawnProps(float x, float z) { PropsType randomType = GetRandomType(); switch (randomType) { case PropsType.grass: GameObject grass = Instantiate(grassAssets[Random.Range(0, grassAssets.Length)], transform); grass.transform.localPosition += new Vector3(x + Random.Range(-.05f, .05f), 0, z + Random.Range(-.05f, .05f)); assetsRef.Add(grass); break; case PropsType.leaf: GameObject leaf = Instantiate(packLeafsAssets[Random.Range(0, packLeafsAssets.Length)], transform); leaf.transform.localPosition += new Vector3(x + Random.Range(-.05f, .05f), 0, z + Random.Range(-.05f, .05f)); leaf.transform.rotation = Quaternion.Euler(new Vector3(0, Random.Range(0, 360), 0)); assetsRef.Add(leaf); break; case PropsType.packLeafs: GameObject packLeafs = Instantiate(leafAssets[Random.Range(0, leafAssets.Length)], transform); packLeafs.transform.localPosition += new Vector3(x + Random.Range(-.05f, .05f), 0, z + Random.Range(-.05f, .05f)); packLeafs.transform.rotation = Quaternion.Euler(new Vector3(0, Random.Range(0, 360), 0)); assetsRef.Add(packLeafs); break; case PropsType.stone: GameObject stone = Instantiate(stoneAssets[Random.Range(0, stoneAssets.Length)], transform); stone.transform.localPosition += new Vector3(x + Random.Range(-.05f, .05f), 0, z + Random.Range(-.05f, .05f)); stone.transform.rotation = Quaternion.Euler(new Vector3(0, Random.Range(0, 360), 0)); stone.transform.localScale *= Random.Range(.8f, 1.2f); assetsRef.Add(stone); break; case PropsType.none: break; } }
/// <summary> /// 拾取道具 /// </summary> private void PickUpProps(PropsType propsType, PropsBase props) { switch (propsType) { case PropsType.Cure: Cure cure = props as Cure; if (cure != null) { Dispatch(AreaCode.AUDIO, AudioEvent.PLAY_PICKUP_CURE, Camera.main.transform.position); Dispatch(AreaCode.GAME, GameEvent.GAME_AUGMENT_HP, cure.Value); //给玩家加血 Dispatch(AreaCode.GAME, GameEvent.GAME_REMOVE_PROPS_SEND, cure.id); //移除道具 } break; case PropsType.Food: Food food = props as Food; if (food != null) { Dispatch(AreaCode.AUDIO, AudioEvent.PLAY_PICKUP_FOOD, Camera.main.transform.position); Dispatch(AreaCode.GAME, GameEvent.GAME_AUGMENT_HG, food.value); Dispatch(AreaCode.GAME, GameEvent.GAME_REMOVE_PROPS_SEND, food.id); } break; case PropsType.Arms: Arm arm = props as Arm; if (arm != null) { Dispatch(AreaCode.AUDIO, AudioEvent.PLAY_PICKUP_ARM, Camera.main.transform.position); PickUpArms(arm); } break; default: break; } }
/// <summary> /// 随机得到某一类物品中的一个 /// </summary> /// <returns></returns> public PropsObject GetObj(PropsType type) { //PropsObject pObj = null; int index = 0; switch (type) { case PropsType.reinforcement: index = Random.Range(101, 1001) % 4; break; case PropsType.negReinforcement: index = Random.Range(101, 1001) % 3 + 5; break; case PropsType.neutralStimulator: index = Random.Range(101, 1001) % 3 + 8; break; default: break; } return(ObjectsManager.instanse.GetProps(index)); }
public void GenerateProps(PropsType propsType) { this.GenerateProps(++this.m_PropsStartNo, propsType); }
//装备类型的构造函数; public EquipmentP(int intelligence, int id, string name, PropsType propsType, PropRarity propRarity, string description, int capacity, string sprite) : base(id, name, propsType, propRarity, description, capacity, sprite) { Intelligence = intelligence; }
public void GenerateProps(PropsType propsType) { this.m_PropsModule.GenerateProps(propsType); }
public Props(int id, string name, Quality quality, string description, string sprite, PropsType propsType, int count) : base(id, name, quality, description, sprite) { this.PropsType = propsType; this.count = count; ItemType = ItemType.Props; }
public GiftPack(int id, string name, Quality quality, string description, string sprite, PropsType propsType, GiftType giftType, int count) : base(id, name, quality, description, sprite, propsType, count) { propsType = PropsType.GiftPack; this.GiftType = giftType; }
/// <summary> /// 武器的构造函数 /// </summary> public WeaponP(int damage, int increaseSpeed, int id, string name, PropsType propsType, PropRarity propRarity, string description, int capacity, string sprite) : base(id, name, propsType, propRarity, description, capacity, sprite) { Damage = damage; IncreaseSpeed = increaseSpeed; }
//消耗品的构造函数 public ConsumableP(int hp, int mp, int id, string name, PropsType type, PropRarity propRarity, string description, int capacity, string sprite) : base(id, name, type, propRarity, description, capacity, sprite) { MP = mp; HP = hp; }
public static string GetUIGridSortString(this PropsType propsType) { string result = (int)propsType > 9 ? ((int)propsType).ToString() : "0" + ((int)propsType).ToString(); result = PROPS_SORT_STRING_PREFIX + result; return result; }
public GameObject GetPropsPrefab(PropsType propsType) { GameObject result = this.m_PreloadPropsPrefab[propsType]; return(result); }