예제 #1
0
 public Tank(TankTypes tankType, int armor, int damage, int ammo, int health)
 {
     TankType = tankType;
     Armor    = armor;
     Damage   = damage;
     Ammo     = (NaturalNumber)ammo;
     Health   = (NaturalNumber)health;
 }
예제 #2
0
파일: Tank.cs 프로젝트: reddogyy/Learning
 public Tank(int height, int width, Position position, TankTypes type)
     : base(height, width, position)
 {
     this.Height = height;
     this.Width = width;
     this.Position = position;
     this.Type = type;
     MakeSuit();
 }
예제 #3
0
        private static IEnumerator WaitForSpriteHandler()
        {
            // We want a singleton method here
            if (bWaitingForSpriteHandler)
            {
                yield break;
            }

            bWaitingForSpriteHandler = true;

#if SUBNAUTICA_STABLE
            while (SpriteManager.GetWithNoDefault(TechType.Cutefish) == null)
#elif BELOWZERO
            while (!SpriteManager.hasInitialized)
#endif
            {
                yield return(new WaitForSecondsRealtime(0.5f));
            }

            Log.LogDebug($"WaitForSpriteHandler(): Sprite manager initialisation complete. pendingTanks.Count == {pendingTanks.Count}");
            HashSet <TechType> removals = new HashSet <TechType>();
            while (pendingTanks.Count > 0)
            {
                removals.Clear();
                var pendingCopy = new Dictionary <TechType, PendingTankEntry>(pendingTanks); // Cloning a dictionary is probably expensive, but this only needs to be done early during startup and then doesn't need
                // to be done again. It might increase the initial load time a bit, but it won't affect in-game performance.
                foreach (KeyValuePair <TechType, PendingTankEntry> kvp in pendingCopy)
                {
                    try
                    {
                        //Log.LogDebug($"WaitForSpriteHandler(): key {kvp.Key.AsString()}");
                        TechType key = kvp.Key;
                        Log.LogDebug($"WaitForSpriteHandler(): key {key.AsString()}");

                        float  capacity = kvp.Value.capacity;
                        Sprite icon     = kvp.Value.icon;
                        if (icon == null)
                        {
                            Log.LogDebug($"WaitForSpriteHandler(): Searching for icon for TechType {key.AsString(false)}");
                            if (icon == null)
                            {
                                icon = SpriteUtils.GetSpriteWithNoDefault(kvp.Key);
                            }
                        }
                        if (icon != null)
                        {
                            Log.LogDebug($"WaitForSpriteHandler(): Found icon for TechType {key.AsString(false)}: {icon.texture.name}");
                            TankTypes.AddTank(key, capacity, icon, kvp.Value.bUnlockAtStart);
                            removals.Add(key);
                        }
                        else
                        {
                            Log.LogError($"Error retrieving sprite for TechType {kvp.Key.AsString()}");
                        }
                    }
                    catch (Exception e)
                    {
                        Log.LogDebug($"WaitForSpriteHandler(): Caught exception: {e.ToString()}\nat key {kvp.Key.AsString()}");
                    }
                }

                foreach (TechType tt in removals)
                {
                    pendingTanks.Remove(tt);
                }

                yield return(new WaitForEndOfFrame());
            }

            bWaitingForSpriteHandler = false;
        }
예제 #4
0
파일: Suit.cs 프로젝트: reddogyy/Learning
 public Suit(TankTypes type)
 {
 }
예제 #5
0
 private void CorrectData(IEntity tankEntity, Teams team, TankTypes tankType, string tankTag)
 {
     ref GameObjectComponent     tankGameObjectComponent = ref tankEntity.GetComponent <GameObjectComponent>();