public void LoadList(GameCamp camp) { ShipNames[camp].Clear(); ShipPath = Application.dataPath + "/Resources/Ship"; ListShipName(ShipPath, camp); }
public List <Actor> GetAllPlayerActorList(GameCamp OwnerCamp) { List <Actor> actors = new List <Actor>(); foreach (KeyValuePair <int, Actor> kv in mActorDic) { actors.Add(kv.Value); } return(actors); }
public List <Actor> GetEnemyPlayerActorList(GameCamp OwnerCamp) { if (OwnerCamp == GameCamp.BLUE) { return(GetFriendPlayerActorList(GameCamp.RED)); } else { return(GetFriendPlayerActorList(GameCamp.BLUE)); } }
public List <Actor> GetFriendSoldiersActorList(GameCamp OwnerCamp) { List <Actor> actors = new List <Actor>(); foreach (KeyValuePair <int, Actor> kv in mSoldiersActorDic) { if (kv.Value.OwnerCamp == OwnerCamp) { actors.Add(kv.Value); } } return(actors); }
public void AddCubeCollider(Vector2 pos, int width, int height, GameCamp camp) { StepCollider info = new StepCollider(pos, width, height, camp); StepColliders.Add(StepIndex, info); if (camp == GameCamp.Player) { PlayerIndexs.Add(StepIndex++); } if (camp == GameCamp.Enemy) { EnemyIndexs.Add(StepIndex++); } }
public void AddSphereCollider(Vector2 pos, int r, GameCamp camp) { StepCollider info = new StepCollider(pos, r, camp); StepColliders.Add(StepIndex, info); if (camp == GameCamp.Player) { PlayerIndexs.Add(StepIndex++); } if (camp == GameCamp.Enemy) { EnemyIndexs.Add(StepIndex++); } }
public void SaveShip(Ship ship, GameCamp camp) { List <ShipData.PlaceRecord> records = new List <ShipData.PlaceRecord>(); foreach (var component in ship.ShipComponents.Values) { ShipData.PlaceRecord record; record.id = component.Id; record.level = component.ShipCompoionentLevel; record.mirror = (int)component.Mirror; record.pos = component.pos; record.rotation = (int)component.Rotation; records.Add(record); } byte[] shipBytes = SerializeHelp.WriteObjectData(new ShipData(ship.ShipName, records)); SerializeHelp.WriteFile(Application.dataPath + @"/Resources/Ship/" + camp.ToString() + ship.ShipName + ".ship", shipBytes); }
public void ListShipName(string path, GameCamp camp) { //获取指定文件夹的所有文件 string[] paths = Directory.GetFiles(path); foreach (var item in paths) { //获取文件后缀名 string extension = Path.GetExtension(item).ToLower(); if (extension == ".ship") { string theName = Path.GetFileNameWithoutExtension(item); if (theName.Contains(camp.ToString())) { ShipNames[camp].Add(Regex.Replace(theName, camp.ToString(), "")); } } } }
public Ship LoadShipAtTransform(string shipName, Transform theTransform, GameCamp camp, ShipControlMode mode = ShipControlMode.Building) { byte[] shipBytes = SerializeHelp.ReadFile(Application.dataPath + "/Resources/Ship/" + camp.ToString() + shipName + ".ship"); ShipData shipData = SerializeHelp.ReadObjectData <ShipData>(shipBytes); GameObject shipObject = Instantiate(EmptyShip, theTransform.position, theTransform.rotation); Ship ship = shipObject.GetComponent <Ship>(); ship.ShipName = ship.name = shipData.ShipName; foreach (var component in shipData.Records) { ship.AddComponent(component.id, component.level, new Vector2Int((int)component.pos.x, (int)component.pos.y), (ShipEnum.ShipUnitRotation)Enum.ToObject(typeof(ShipEnum.ShipUnitRotation), component.rotation), (ShipEnum.ShipUnitMirror)Enum.ToObject(typeof(ShipEnum.ShipUnitMirror), component.mirror)); } ship.SetCamp(camp); ShipManager.Instance.ships[camp].Add(ship); ship.control.mode = mode; return(ship); }
public void SetCamp(GameCamp camp) { throw ShipProjectExpection.SetCampException(1); }
public virtual void SetCamp(GameCamp camp) { this.camp = camp; }
public void SetCamp(GameCamp camp) { ShipCamp = camp; }