private void Effect() { List <BuildingAI> affectedBuildings = new List <BuildingAI>(); int distanceSqrt = this.Scope * this.Scope; Vector2 targetPosition = (Vector2)this.transform.position; TilePosition targetTile = PositionConvertor.GetActorTileIndexFromWorldPosition(this.transform.position); int radius = Mathf.CeilToInt(this.Scope / (float)Mathf.Min(ClientSystemConstants.ACTOR_TILE_MAP_TILE_SIZE.width, ClientSystemConstants.ACTOR_TILE_MAP_TILE_SIZE.height)); List <TilePosition> affectedTiles = RoundHelper.FillCircle(targetTile.Column, targetTile.Row, radius); foreach (TilePosition tile in affectedTiles) { if (tile.IsValidActorTilePosition()) { Vector2 p = (Vector2)PositionConvertor.GetWorldPositionFromActorTileIndex(tile); Vector2 dis = p - targetPosition; if (dis.sqrMagnitude <= distanceSqrt) { GameObject building = BattleMapData.Instance.GetBulidingObjectFromActorObstacleMap(tile.Row, tile.Column); if (building != null) { BuildingAI ai = building.GetComponent <BuildingAI>(); if (ai != null && !affectedBuildings.Contains(ai)) { affectedBuildings.Add(ai); ai.SetTarget(this.gameObject, (Vector2)this.transform.position); } } } } } }
void OnMoveAllWall() { //print("OnMoveAllWall"); //m_EnableBuildAll = true; for (int i = 0; i < SceneManager.Instance.SelectedAllWallList.Count; i++) { WallBehavior wallBehavior = SceneManager.Instance.SelectedAllWallList[i]; if (wallBehavior.FirstZoneIndex.Equals(wallBehavior.BuildingLogicData.BuildingPosition)) { if (wallBehavior.IsBuild) { wallBehavior.UnBuild(); this.SetSelectWallState(); } } UIManager.Instance.HidePopuBtnByCurrentSelect(true); List <UICamera.MouseOrTouch> mouseOrTouchList = new List <UICamera.MouseOrTouch>(base.MouseOrTouchDictionary.Values); TilePosition touchDownZone = PositionConvertor.GetBuildingTileIndexFromScreenPosition(mouseOrTouchList[0].pos); TilePosition offsetZone = touchDownZone - base.TouchDownZone; if (!((wallBehavior.FirstZoneIndexPrevious + offsetZone).Equals(wallBehavior.FirstZoneIndex))) { AudioController.Play("BuildingMoving"); } wallBehavior.FirstZoneIndex = wallBehavior.FirstZoneIndexPrevious + offsetZone; Vector3 position = PositionConvertor.GetWorldPositionByBuildingTileIndex(wallBehavior.FirstZoneIndex); position.z = wallBehavior.BUILDING_PICK_AXIS_Z; wallBehavior.transform.position = position; wallBehavior.CheckTile(); } }
public void ConstructDefender() { GameObject defender = GameObject.Instantiate(this.m_DefenderPrefab) as GameObject; defender.transform.position = transform.position; defender.transform.parent = this.m_ParentNode; /* * DefenderBehavior behavior = defender.GetComponent<DefenderBehavior>(); * behavior.MapData = this.m_MapData; * * * ArmyWeightDataCalculator weightCalculator = defender.GetComponent<ArmyWeightDataCalculator>(); * weightCalculator.MapData = this.m_MapData; * * CharacterWalk walk = defender.GetComponent<CharacterWalk>(); * walk.MapData = this.m_MapData; */ //CharacterHPBehavior hpBehavior = defender.GetComponent<CharacterHPBehavior>(); CharacterPropertyBehavior property = defender.GetComponent <CharacterPropertyBehavior>(); property.CharacterType = CharacterType.Defender; BattleSceneHelper.Instance.ConstructActor (defender, PositionConvertor.GetActorTileIndexFromWorldPosition(defender.transform.position)); }
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 override void AICalculate() { if (this.m_Target == null) { BombermanIdleState idleState = new BombermanIdleState(this.m_AIBehavior, false); this.m_AIBehavior.ChangeState(idleState); } else { float distanceSqr = Vector2.SqrMagnitude((Vector2)PositionConvertor.GetWorldPositionFromActorTileIndex (this.m_TargetPosition) - (Vector2)this.m_AIBehavior.transform.position); if (distanceSqr <= this.CharacterAI.AttackBehavior.AttackScopeSqr) { this.m_HPBehavior.Bomb(); List <GameObject> relatedBuildings = new List <GameObject>(); if (this.CharacterAI.AttackBehavior.DamageScope > 0) { relatedBuildings = BattleSceneHelper.Instance.GetNearByBuilding(this.m_AIBehavior.transform.position, this.CharacterAI.AttackBehavior.DamageScope); } else { relatedBuildings.Add(this.m_Target); } foreach (GameObject building in relatedBuildings) { BuildingHPBehavior targetHP = building.GetComponent <BuildingHPBehavior>(); targetHP.DecreaseHP(this.CharacterAI.AttackBehavior.AttackValue, this.CharacterAI.AttackBehavior.AttackCategory); } } else { base.AICalculate(); } } }
protected override void Calculate() { TilePosition affectPosition = PositionConvertor.GetActorTileIndexFromWorldPosition(this.DestinationObject.GetDestinationPosition(this.transform.position)); List <TilePosition> affectedTiles = RoundHelper.FillCircle (affectPosition.Column, affectPosition.Row, Mathf.CeilToInt(this.DamageScope / (float)Mathf.Min(ClientSystemConstants.ACTOR_TILE_MAP_TILE_SIZE.height, ClientSystemConstants.ACTOR_TILE_MAP_TILE_SIZE.width))); foreach (TilePosition tile in affectedTiles) { if (tile.IsValidActorTilePosition()) { List <GameObject> characters = BattleMapData.Instance.ActorArray[tile.Row, tile.Column]; foreach (GameObject character in characters) { CharacterPropertyBehavior property = character.GetComponent <CharacterPropertyBehavior>(); if (property.CharacterType == CharacterType.Invader) { //float distance = Vector2.Distance((Vector2)this.transform.position, (Vector2)character.transform.position); //float percentage = (1 - distance) / this.m_GroupDamageScope; //percentage = Mathf.Max(percentage, 0); CharacterHPBehavior hpBehavior = character.GetComponent <CharacterHPBehavior>(); hpBehavior.DecreaseHP(this.Damage, this.AttackCategory); this.PushCharacter(character); } } } } }
public List <GameObject> GetNearByBuilding(Vector3 position, int scope) { List <GameObject> result = new List <GameObject>(); int distanceSqrt = scope * scope; TilePosition tilePosition = PositionConvertor.GetActorTileIndexFromWorldPosition(position); int radius = Mathf.CeilToInt(scope / (float)Mathf.Min(ClientSystemConstants.ACTOR_TILE_MAP_TILE_SIZE.width, ClientSystemConstants.ACTOR_TILE_MAP_TILE_SIZE.height)); List <TilePosition> affectedTiles = RoundHelper.FillCircle(tilePosition.Column, tilePosition.Row, radius); foreach (TilePosition tile in affectedTiles) { if (tile.IsValidActorTilePosition()) { Vector2 p = (Vector2)PositionConvertor.GetWorldPositionFromActorTileIndex(tile); Vector2 dis = p - (Vector2)position; if (dis.sqrMagnitude <= distanceSqrt) { GameObject building = BattleMapData.Instance.GetBulidingObjectFromActorObstacleMap(tile.Row, tile.Column); if (building != null && !result.Contains(building) && building.GetComponent <BuildingHPBehavior>() != null) { result.Add(building); } } } } return(result); }
public override void AICalculate() { float distanceSqr = Vector2.SqrMagnitude((Vector2)PositionConvertor.GetWorldPositionFromActorTileIndex (this.m_TargetPosition) - (Vector2)this.m_AIBehavior.transform.position); if (this.m_Target == null) { InvaderIdleState idleState = new InvaderIdleState(this.m_AIBehavior, false); this.m_AIBehavior.ChangeState(idleState); } else { if (distanceSqr <= this.CharacterAI.AttackBehavior.AttackScopeSqr) { BuildingBasePropertyBehavior property = this.m_Target.GetComponent <BuildingBasePropertyBehavior>(); AttackState attackState; if (property == null) { attackState = new InvaderAttackState(this.m_AIBehavior, new AITargetObject(this.m_Target, this.m_Target.transform.position), this.CharacterAI.AttackBehavior); } else { attackState = new InvaderAttackState(this.m_AIBehavior, new AITargetObject(this.m_Target, (Vector2)(PositionConvertor.GetWorldPositionFromActorTileIndex(this.m_TargetPosition))), this.CharacterAI.AttackBehavior); } this.m_AIBehavior.ChangeState(attackState); } else { base.AICalculate(); } } }
public void SendBuilderBuild(int builderNO, int builderLevel, IObstacleInfo targetInfo, IMapData mapData) { GameObject builder = null; if (this.m_Builders.ContainsKey(builderNO)) { builder = this.m_Builders[builderNO]; builder.SetActive(true); } else { builder = this.GenerateBuilder(builderNO, builderLevel); this.m_Builders.Add(builderNO, builder); } TilePosition buildPoint = BorderPointHelper.FindValidInflateOneBorderPoint(targetInfo); builder.transform.position = PositionConvertor.GetWorldPositionFromActorTileIndex(buildPoint); BuilderAI builderAI = builder.GetComponent <BuilderAI>(); builderAI.MapData = mapData; builderAI.BuilderNO = builderNO; builderAI.Build(targetInfo, buildPoint); }
void OnDrawGizmos() { if (this.m_BuildingObstacleArray != null && this.m_ActorObstacleArray != null) { int column = ClientSystemConstants.BUILDING_TILE_MAP_SIZE.width; int row = ClientSystemConstants.BUILDING_TILE_MAP_SIZE.height; for (int i = 0; i < column; i++) { for (int j = 0; j < row; j++) { if (this.m_BuildingObstacleArray[j, i] != null) { TilePosition tp = new TilePosition(i, j); Gizmos.color = Color.blue; Gizmos.DrawSphere(PositionConvertor.GetWorldPositionByBuildingTileIndex(tp), 8); } } } int columnActor = ClientSystemConstants.ACTOR_TILE_MAP_SIZE.width; int rowActor = ClientSystemConstants.ACTOR_TILE_MAP_SIZE.height; for (int i = 0; i < columnActor; i++) { for (int j = 0; j < rowActor; j++) { if (this.m_ActorObstacleArray[j, i] != null) { TilePosition tp = new TilePosition(i, j); Gizmos.color = Color.magenta; Gizmos.DrawSphere(PositionConvertor.GetWorldPositionByActorTileIndex(tp), 4); } } } } }
public override void AICalculate() { CharacterAI characterAI = (CharacterAI)this.m_AIBehavior; if (this.m_Ticks++ == this.m_PushTicks) { characterAI.SetIdle(false); } else { this.m_PushVelocity *= this.m_PushAttenuateFactor; Vector2 v = this.m_PushVelocity * this.m_PushFactor; Vector2 newPosition = (Vector2)this.m_AIBehavior.transform.position + v; newPosition = PositionConvertor.ClampWorldPositionOfActorTile(newPosition); TilePosition currentTile = PositionConvertor.GetActorTileIndexFromWorldPosition(this.m_AIBehavior.transform.position); TilePosition newTile = PositionConvertor.GetActorTileIndexFromWorldPosition(new Vector3(newPosition.x, newPosition.y)); if (BattleMapData.Instance.ActorCanPass(newTile.Row, newTile.Column) && BattleMapData.Instance.ActorCanPass(currentTile.Row, currentTile.Column)) { this.m_AIBehavior.transform.position = new Vector3(newPosition.x, newPosition.y, this.m_AIBehavior.transform.position.z); if (newTile != this.m_PreviousPosition) { BattleMapData.Instance.RefreshInformationWithMoveActor(this.m_AIBehavior.gameObject, this.m_PreviousPosition, newTile); this.m_PreviousPosition = newTile; if (characterAI.BattleMapData.ActorCanPass(newTile.Row, newTile.Column)) { characterAI.PreviousValidPosition = newTile; } } } } }
public override void Initial() { this.m_PushVelocity = this.m_Velocity * this.m_Direction; this.m_PreviousPosition = PositionConvertor.GetActorTileIndexFromWorldPosition(this.m_AIBehavior.transform.position); this.m_AnimationController.PlayIdleAnimation(); }
void OnMoveWall() { print("OnMoveWall"); if (base.FirstZoneIndex.Equals(base.FirstZoneIndexPrevious))//this.BuildingBehavior.BuildingLogicData.BuildingPosition)) { if (base.IsBuild) { base.UnBuild(); UIManager.Instance.HidePopuBtnByCurrentSelect(true); } } if (base.MouseOrTouchDictionary.Count > 0) { List <UICamera.MouseOrTouch> mouseOrTouchList = new List <UICamera.MouseOrTouch>(base.MouseOrTouchDictionary.Values); TilePosition touchDownZone = PositionConvertor.GetBuildingTileIndexFromScreenPosition(mouseOrTouchList[0].pos); TilePosition offsetZone = touchDownZone - base.TouchDownZone; if (!((base.FirstZoneIndexPrevious + offsetZone).Equals(base.FirstZoneIndex))) { AudioController.Play("BuildingMoving"); } base.FirstZoneIndex = base.FirstZoneIndexPrevious + offsetZone; Vector3 position = PositionConvertor.GetWorldPositionByBuildingTileIndex(base.FirstZoneIndex); position.z = base.BUILDING_PICK_AXIS_Z; this.transform.position = position; //this.BuildingBehavior.EnableCreate = base.CheckTile(); base.SetButtonOkState(); } }
new void Build() { for (int i = 0; i < m_RealBuildObstalceList.Count; i++) { SceneManager.Instance.BuildingMapData[base.FirstZoneIndex.Row + m_RealBuildObstalceList[i].Row, base.FirstZoneIndex.Column + m_RealBuildObstalceList[i].Column] = false; SceneManager.Instance.BuildingGameObjectData[base.FirstZoneIndex.Row + m_RealBuildObstalceList[i].Row, base.FirstZoneIndex.Column + m_RealBuildObstalceList[i].Column] = this.gameObject; } TilePosition actorFirstZoneIndex = PositionConvertor.GetActorTilePositionFromBuildingTilePosition(base.FirstZoneIndex); for (int i = 0; i < m_RealActorObstacleList.Count; i++) { //SceneManager.Instance.ActorMapData[actorFirstZoneIndex.Row + m_RealActorObstacleList[i].Row, actorFirstZoneIndex.Column + m_RealActorObstacleList[i].Column] = false; SceneManager.Instance.ActorGameObjectData[actorFirstZoneIndex.Row + m_RealActorObstacleList[i].Row, actorFirstZoneIndex.Column + m_RealActorObstacleList[i].Column] = this.gameObject; } if (!base.FirstZoneIndex.Equals(this.AchievementBuildingLogicData.BuildingPosition)) { LogicController.Instance.MoveAchievementBuiding(this.AchievementBuildingLogicData.BuildingNo, base.FirstZoneIndex); this.OnCreateBorder(BorderType.BuildingOutlineBorder); } else { this.OnDestroyBorder(); } this.transform.position = PositionConvertor.GetWorldPositionByBuildingTileIndex(base.FirstZoneIndex); this.m_IsBuild = true; base.EnableCreate = true; this.CreateDropDownFX(); this.SetCellVisible(false); }
public void FindTargetObject(IBuildingInfo buildingInfo, TilePosition startPosition) { List <IBuildingInfo> buildings = this.SceneHelper.GetAllBuildings(); int index = Random.Range(0, buildings.Count); IBuildingInfo targetBuildingInfo = buildings[index]; if (buildingInfo != null) { while (buildingInfo == targetBuildingInfo) { index = Random.Range(0, buildings.Count); targetBuildingInfo = buildings[index]; } } TilePosition targetPoint = BorderPointHelper.FindValidInflateOneBorderPoint(targetBuildingInfo); if (startPosition != null) { this.transform.position = PositionConvertor.GetWorldPositionFromActorTileIndex(startPosition); } VillagerWalkState walkState = new VillagerWalkState(this.MapData, targetPoint, this, targetBuildingInfo); this.ChangeState(walkState); }
private void Appear() { List <IBuildingInfo> buildings = ((VillagerAI)this.m_AIBehavior).SceneHelper.GetBuildingsOfTypes(this.m_AppearBuildings); int index = Random.Range(0, buildings.Count); IBuildingInfo appearBuilding = buildings[index]; while (appearBuilding.IsBuildingHover(((VillagerAI)this.m_AIBehavior).MapData)) { index = Random.Range(0, buildings.Count); appearBuilding = buildings[index]; } List <TilePosition> borders = BorderPointHelper.GetBorder(appearBuilding); index = Random.Range(0, borders.Count); TilePosition appearPoint = appearBuilding.ActorPosition + borders[index]; while (!appearPoint.IsValidActorTilePosition()) { index = Random.Range(0, borders.Count); appearPoint = appearBuilding.BuildingPosition + borders[index]; } this.m_AIBehavior.transform.position = PositionConvertor.GetWorldPositionFromActorTileIndex(appearPoint); this.m_AnimationController.SetVisible(); }
//void InitObstaclePosition() //{ // if (this.RemovableObjectLogicData.BuildingPosition != null) // { // base.FirstZoneIndex = this.RemovableObjectLogicData.BuildingPosition; // this.transform.position = PositionConvertor.GetWorldPositionByBuildingTileIndex(base.FirstZoneIndex); // this.BuildObstacle(); // } //} void InitObstaclePosition() { if (!this.Created) { base.FirstZoneIndex = PositionConvertor.GetBuildingTileIndexFromWorldPosition(CameraManager.Instance.MainCamera.transform.position); if (!base.CheckTile()) { base.SearchBuildingPosition(); } this.CheckTile(); Vector3 position = PositionConvertor.GetWorldPositionByBuildingTileIndex(base.FirstZoneIndex); position.z = BUILDING_PICK_AXIS_Z; this.transform.position = position; base.SetArrowState(true); base.IsClick = true; } else { if (this.RemovableObjectLogicData.BuildingPosition != null) { base.FirstZoneIndex = this.RemovableObjectLogicData.BuildingPosition; this.transform.position = PositionConvertor.GetWorldPositionByBuildingTileIndex(base.FirstZoneIndex); this.BuildObstacle(); base.SetArrowState(false); } } }
public void Drag() { Vector3 worldPosition = EditorConfigInterface.Instance.SceneCamera.ScreenToWorldPoint(Input.mousePosition); TilePosition currentPosition = PositionConvertor.GetBuildingTileIndexFromWorldPosition(worldPosition); this.Position = currentPosition; this.OperatorBehavior.transform.position = PositionConvertor.GetWorldPositionByBuildingTileIndex(this.Position); }
protected override void FindPath() { List <TilePosition> aStarPath; List <TilePosition> linePath = AStarPathFinder.CalculatePathTile(this.FindPathStrategy, this.CharacterAI.BattleMapData.ActorObstacleArray, this.m_PreviousPosition, this.m_TargetPosition, out aStarPath); //this.CharacterAI.DrawPath(aStarPath); /* * Debug.Log("AStar Path Length is:" + aStarPath.Count); * foreach(TilePosition at in aStarPath) * { * Debug.Log("row:" + at.Row + " ,column:" + at.Column); * } * Debug.Log("Line Path Length is:" + linePath.Count); * foreach (TilePosition lt in linePath) * { * Debug.Log("row:" + lt.Row + " ,column:" + lt.Column); * } */ this.SetPath(linePath); if (linePath.Count == 0) { this.OnTargetReached(); } else { TilePosition targetTilePosition = linePath[linePath.Count - 1]; if (this.m_MapData.GetBulidingObjectFromActorObstacleMap(targetTilePosition.Row, targetTilePosition.Column) != this.m_Target) { Vector2 reachablePosition = (Vector2)PositionConvertor.GetWorldPositionFromActorTileIndex(linePath[linePath.Count - 2]); TilePosition targetTile = aStarPath[aStarPath.Count - 1]; for (int i = 1; i < aStarPath.Count; i++) { if (this.m_MapData.GetBulidingObjectFromActorObstacleMap(aStarPath[i].Row, aStarPath[i].Column) == this.m_Target) { targetTile = aStarPath[i]; break; } } Vector2 targetPosition = (Vector2)PositionConvertor.GetWorldPositionFromActorTileIndex(targetTile); if (Vector2.SqrMagnitude(targetPosition - reachablePosition) <= this.CharacterAI.AttackBehavior.AttackScopeSqr) { this.m_TargetPosition = targetTile; this.ShowTarget(); return; } } this.m_TargetPosition = targetTilePosition; this.m_Target = this.CharacterAI.BattleMapData.GetBulidingObjectFromActorObstacleMap (this.m_TargetPosition.Row, this.m_TargetPosition.Column); this.ShowTarget(); } }
private List <TilePosition> GetTilePositionList(int scope) { TilePosition actorPosition = PositionConvertor.GetActorTileIndexFromWorldPosition (this.m_Property.AnchorTransform.position); int radius = Mathf.CeilToInt(scope / (float)Mathf.Min(ClientSystemConstants.ACTOR_TILE_MAP_TILE_SIZE.width, ClientSystemConstants.ACTOR_TILE_MAP_TILE_SIZE.height)); return(RoundHelper.FillCircle(actorPosition.Column, actorPosition.Row, radius)); }
public void GenerateArmyInCamp(IBuildingInfo campInfo) { this.transform.position = PositionConvertor.GetWorldPositionFromActorTileIndex( this.FindCampStandablePoint(campInfo)) + new Vector3(Random.Range(-ClientSystemConstants.ACTOR_TILE_MAP_TILE_SIZE.width / 2, ClientSystemConstants.ACTOR_TILE_MAP_TILE_SIZE.height / 2), Random.Range(-ClientSystemConstants.ACTOR_TILE_MAP_TILE_SIZE.width / 2, ClientSystemConstants.ACTOR_TILE_MAP_TILE_SIZE.height / 2), 0); ArmyIdleState idleState = new ArmyIdleState(this, campInfo); this.ChangeState(idleState); }
private void ConstructDefenseObject(BattleDefenseObjectParameter param) { PropsConfigData configData = ConfigInterface.Instance.PropsConfigHelper.GetPropsData(param.PropsType); PropsDefenseScopeConfigData defenseData = configData.FunctionConfigData as PropsDefenseScopeConfigData; PropsDefenseScopeLastingConfigData lastingData = configData.FunctionConfigData as PropsDefenseScopeLastingConfigData; DefenseObjectConfigWrapper configWrapper = new DefenseObjectConfigWrapper(configData.FunctionConfigData); GameObject defenseObjectPrefab = Resources.Load(ClientStringConstants.BATTLE_SCENE_RESOURCE_PREFAB_PREFIX_NAME + ClientStringConstants.DEFENSE_OBJECT_PREFAB_PREFIX_NAME + configWrapper.PrefabName) as GameObject; GameObject defenseObject = GameObject.Instantiate(defenseObjectPrefab) as GameObject; defenseObject.transform.position = PositionConvertor.GetWorldPositionFromBuildingTileIndex (new TilePosition(param.PositionColumn, param.PositionRow)); DefenseObjectAI ai = defenseObject.GetComponent <DefenseObjectAI>(); ai.enabled = false; DefenseObjectPropertyBehavior property = defenseObject.GetComponent <DefenseObjectPropertyBehavior>(); property.DefenseObjectID = param.DefenseObjectID; property.BuildingPosition = new TilePosition(param.PositionColumn, param.PositionRow); property.ActorObstacleList = new List <TilePosition>(); property.BuildingObstacleList = new List <TilePosition>(); if (defenseData != null) { BombBehavior bomb = defenseObject.GetComponent <BombBehavior>(); bomb.AttackCategory = defenseData.AttackCategory; bomb.Damage = defenseData.Damage; bomb.PushVelocity = defenseData.PushVelocity; bomb.PushTicks = defenseData.PushTicks; bomb.Scope = defenseData.Scope; bomb.TriggerScope = defenseData.TriggerScope; bomb.TriggerTick = defenseData.TriggerTicks; bomb.TargetType = (TargetType)defenseData.TargetType; bomb.ParentNode = this.m_BulletParent; } else if (lastingData != null) { LastingEffectBehavior lasting = defenseObject.GetComponent <LastingEffectBehavior>(); lasting.AttackCategory = lastingData.AttackCategory; lasting.Damage = lastingData.Damage; lasting.IntervalTicks = lastingData.IntervalTicks; lasting.TotalTimes = lastingData.TotalTimes; lasting.Scope = lastingData.Scope; lasting.TriggerScope = lastingData.TriggerScope; lasting.TriggerTick = lastingData.TriggerTicks; lasting.TargetType = (TargetType)lastingData.TargetType; //lasting.ParentNode = this.m_ParentNode; } defenseObject.transform.parent = this.m_ParentNode; this.m_SceneHelper.ConstructDefenseObject(defenseObject); }
public override void Initial() { this.m_PreviousPosition = PositionConvertor.GetActorTileIndexFromWorldPosition (this.m_AIBehavior.gameObject.transform.position); if (this.m_LinePath == null || this.m_LinePath.Count == 0) { this.FindPath(); } }
public virtual void SetPush(int pushTicks, int pushVelocity, Vector3 pushSource) { TilePosition currentPosition = PositionConvertor.GetActorTileIndexFromWorldPosition(this.transform.position); if (BattleMapData.Instance.ActorCanPass(currentPosition.Row, currentPosition.Column)) { PushState pushState = new PushState(this, pushTicks, pushVelocity, this.transform.position - pushSource); this.ChangeState(pushState); } }
public void SendMercenaryToCamp(MercenaryType mercenaryType, IBuildingInfo campInfo, IBuildingInfo factoryInfo) { GameObject mercenary = this.GenerateMercenary(mercenaryType); TilePosition initialPoint = BorderPointHelper.FindValidInflateOneBorderPoint(factoryInfo); mercenary.transform.position = PositionConvertor.GetWorldPositionFromActorTileIndex(initialPoint); ArmyAI ai = mercenary.GetComponent <ArmyAI>(); ai.SendArmyToCamp(campInfo); }
void CreateAchievementBuildingObstacle() { if (!this.Created) { base.m_RealBuildObstalceList = PositionConvertor.TilePointListToTilePositionList(this.AchievementBuildingConfigData.BuildingObstacleList); } else { base.m_RealBuildObstalceList = this.AchievementBuildingLogicData.BuildingObstacleList; } }
public void ConstructRemovableObject(RemovableObjectType type) { RemovableObjectConfigData configData = ConfigInterface.Instance.RemovableConfigHelper.GetRemovableObjectData(type); TilePosition centerPosition = PositionConvertor.GetBuildingTileIndexFromWorldPosition(this.m_SceneCamare.position); TilePosition position = this.FindValidBuildingPosition(centerPosition, configData.BuildingObstacleList); if (position != null) { this.ConstructRemovableObject(type, position); } }
void CreateRemovableObjectObstacle() { if (!this.Created) { base.m_RealBuildObstalceList = PositionConvertor.TilePointListToTilePositionList(this.RemovableObjectConfigData.BuildingObstacleList); } else { base.m_RealBuildObstalceList = this.RemovableObjectLogicData.BuildingObstacleList; } }
public void ConstructBuilding(BuildingType type, int level) { BuildingConfigData configData = ConfigInterface.Instance.BuildingConfigHelper.GetBuildingData(type, level); TilePosition centerPosition = PositionConvertor.GetBuildingTileIndexFromWorldPosition(this.m_SceneCamare.position); TilePosition position = this.FindValidBuildingPosition(centerPosition, configData.BuildingObstacleList); if (position != null) { this.ConstructBuilding(type, level, position); } }
public void SendArmyToCamp(ArmyType armyType, int level, IBuildingInfo campInfo, IBuildingInfo factoryInfo) { GameObject army = this.GenerateArmy(armyType, level); TilePosition initialPoint = BorderPointHelper.FindValidInflateOneBorderPoint(factoryInfo); army.transform.position = PositionConvertor.GetWorldPositionFromActorTileIndex(initialPoint); ArmyAI ai = army.GetComponent <ArmyAI>(); ai.SendArmyToCamp(campInfo); }