private void HandleChampionDeployedEvent(object cookie) { SmartEntity smartEntity = (SmartEntity)cookie; TroopComponent troopComp = smartEntity.TroopComp; if (troopComp == null) { return; } TransformComponent transformComp = smartEntity.TransformComp; if (transformComp == null) { return; } ChampionDeployedAction championDeployedAction = new ChampionDeployedAction(); championDeployedAction.Time = this.GetActionTime(); championDeployedAction.TroopUid = troopComp.TroopType.Uid; championDeployedAction.BoardX = transformComp.CenterGridX(); championDeployedAction.BoardZ = transformComp.CenterGridZ(); TeamComponent teamComp = smartEntity.TeamComp; championDeployedAction.TeamType = teamComp.TeamType; this.battleRecord.Add(championDeployedAction); }
private void ChampionDeployedActionCallback(uint id, object cookie) { ChampionDeployedAction championDeployedAction = cookie as ChampionDeployedAction; IDataController dataController = Service.Get <IDataController>(); TroopTypeVO troopTypeVO = dataController.Get <TroopTypeVO>(championDeployedAction.TroopUid); IntPosition boardPosition = new IntPosition(championDeployedAction.BoardX, championDeployedAction.BoardZ); Service.Get <TroopController>().SpawnChampion(troopTypeVO, championDeployedAction.TeamType, boardPosition); this.battleController.OnChampionDeployed(troopTypeVO.Uid, championDeployedAction.TeamType, boardPosition); }