예제 #1
0
        public void LoadList(GameCamp camp)

        {
            ShipNames[camp].Clear();
            ShipPath = Application.dataPath + "/Resources/Ship";
            ListShipName(ShipPath, camp);
        }
예제 #2
0
        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);
        }
예제 #3
0
 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);
    }
예제 #5
0
    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++);
        }
    }
예제 #6
0
    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++);
        }
    }
예제 #7
0
        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);
        }
예제 #8
0
 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(), ""));
             }
         }
     }
 }
예제 #9
0
        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);
        }
예제 #10
0
 public void SetCamp(GameCamp camp)
 {
     throw ShipProjectExpection.SetCampException(1);
 }
예제 #11
0
 public virtual void SetCamp(GameCamp camp)
 {
     this.camp = camp;
 }
예제 #12
0
파일: Ship.cs 프로젝트: rabiribi/OrbitII
 public void SetCamp(GameCamp camp)
 {
     ShipCamp = camp;
 }