public static IEnumerable <string> CreateImageList(InvaderType shipType) { string filename; switch (shipType) { case InvaderType.Bug: filename = "bug"; break; case InvaderType.Spaceship: filename = "spaceship"; break; case InvaderType.Star: filename = "star"; break; case InvaderType.Satellite: filename = "satellite"; break; default: filename = "flyingsaucer"; break; } List <string> imageList = new List <string>(); for (int i = 1; i <= 4; i++) { imageList.Add(filename + i + ".png"); } return(imageList); }
public Invader(InvaderType invaderType, Point location) : base(location, _invaderSize) { _invaderType = invaderType; _location = location; switch (invaderType) { case InvaderType.bug: InvaderScore = 50; break; case InvaderType.flyingsaucer: InvaderScore = 30; break; case InvaderType.satellite: InvaderScore = 20; break; case InvaderType.spaceship: InvaderScore = 15; break; case InvaderType.star: InvaderScore = 5; break; default: break; } }
public static Color GetColorByInvaderType(InvaderType type) { switch (type) { case InvaderType.Red: return(Color.red); case InvaderType.Orange: return(new Color(0.87f, 0.43f, 0.17f)); case InvaderType.Yellow: return(Color.yellow); case InvaderType.Green: return(Color.green); case InvaderType.Cayn: return(Color.cyan); case InvaderType.Blue: return(Color.blue); case InvaderType.Violet: return(new Color(0.5f, 0.2f, 0.9f)); default: return(Color.black); } }
public Invader(Point location, InvaderType invaderType) : base(location, InvaderSize) { InvaderType = invaderType; switch (InvaderType) { case InvaderType.Spaceship: Score = 50; break; case InvaderType.Bug: Score = 40; break; case InvaderType.Saucer: Score = 30; break; case InvaderType.Satellite: Score = 20; break; case InvaderType.Star: Score = 10; break; default: throw new ArgumentException("Invalid InvaderType! "); } }
void CreateInvader(float x, float y, InvaderType type, int xIndex, int yIndex) { GameObject inv = Instantiate(invaderPrefab, new Vector3(x, y, 0f), Quaternion.identity, transform); InvaderBehaviour invB = inv.GetComponent <InvaderBehaviour>(); invB.Init(type, xIndex, yIndex); }
public Invader(InvaderType invaderType, Point location, int score) { InvaderType = invaderType; Location = location; Score = score; InitializeImages(invaderType); image = InvaderImage(0); }
public static int GetInvaderScore(this InvaderType type) { switch (type) { case InvaderType.Small: return(100); case InvaderType.Big: return(200); default: return(0); } }
public static AnimatedImage InvaderControlFactory(InvaderType type, Point location, double scale) { List <string> imageNames = new List <string> { type + "1.png", type + "2.png", type + "3.png", type + "4.png", }; AnimatedImage invader = new AnimatedImage(imageNames, TimeSpan.FromMilliseconds(100)); ResizeElement(invader, Invader.InvaderSize.Width, Invader.InvaderSize.Height, scale); SetCanvasLocation(invader, location, scale); return(invader); }
public static ushort GetHealthForInvader(InvaderType type) { switch (type) { case (InvaderType.Soldier): return(SOLDIER_HEALTH); case (InvaderType.Archer): return(ARCHER_HEALTH); case (InvaderType.Healer): return(HEALER_HEALTH); } UnityEngine.Debug.LogError("GetHealthForInvader(): Recieved unsupported invader type " + type.ToString()); return(0); }
public static InvasionPosition GetPositionForInvader(InvaderType type) { switch (type) { case (InvaderType.Soldier): return(SOLDIER_POSITION); case (InvaderType.Archer): return(ARCHER_POSITION); case (InvaderType.Healer): return(HEALER_POSITION); } UnityEngine.Debug.LogError("GetPositionForInvader(): Recieved unsupported invader type " + type.ToString()); return(InvasionPosition.Front); }
/// <summary> /// Returns the full name of the image file representing the invader type /// </summary> /// <param name="invaderType"> Type of enemy</param> /// <returns></returns> public string CreateImageName(InvaderType invaderType) { string filename; switch (invaderType) { case InvaderType.Enemy1: filename = "enemy1"; break; default: filename = "enemy2"; break; } return(filename + ".png"); }
public static AnimatedImage InvadersControlFactory(InvaderType invaderType, TimeSpan interval) { List <string> imageNames = new List <string>(); if (invaderType == InvaderType.Bug) { imageNames.Add("Images/bug1.png"); imageNames.Add("Images/bug2.png"); imageNames.Add("Images/bug3.png"); imageNames.Add("Images/bug4.png"); } else if (invaderType == InvaderType.Satellite) { imageNames.Add("Images/satellite1.png"); imageNames.Add("Images/satellite2.png"); imageNames.Add("Images/satellite3.png"); imageNames.Add("Images/satellite4.png"); } else if (invaderType == InvaderType.Saucer) { imageNames.Add("Images/flyingsaucer1.png"); imageNames.Add("Images/flyingsaucer2.png"); imageNames.Add("Images/flyingsaucer3.png"); imageNames.Add("Images/flyingsaucer4.png"); } else if (invaderType == InvaderType.Spaceship) { imageNames.Add("Images/spaceship1.png"); imageNames.Add("Images/spaceship2.png"); imageNames.Add("Images/spaceship3.png"); imageNames.Add("Images/spaceship4.png"); } else if (invaderType == InvaderType.Star) { imageNames.Add("Images/star1.png"); imageNames.Add("Images/star2.png"); imageNames.Add("Images/star3.png"); imageNames.Add("Images/star4.png"); } return(new AnimatedImage(imageNames, interval)); }
private void InitializeImages(InvaderType invaderType) { images = new Bitmap[4]; switch (invaderType) { case InvaderType.Bug: images[0] = Properties.Resources.bug1; images[1] = Properties.Resources.bug2; images[2] = Properties.Resources.bug3; images[3] = Properties.Resources.bug4; break; case InvaderType.Saucer: images[0] = Properties.Resources.flyingsaucer1; images[1] = Properties.Resources.flyingsaucer2; images[2] = Properties.Resources.flyingsaucer3; images[3] = Properties.Resources.flyingsaucer4; break; case InvaderType.Satellite: images[0] = Properties.Resources.satellite1; images[1] = Properties.Resources.satellite2; images[2] = Properties.Resources.satellite3; images[3] = Properties.Resources.satellite4; break; case InvaderType.Spaceship: images[0] = Properties.Resources.spaceship1; images[1] = Properties.Resources.spaceship2; images[2] = Properties.Resources.spaceship3; images[3] = Properties.Resources.spaceship4; break; case InvaderType.Star: images[0] = Properties.Resources.star1; images[1] = Properties.Resources.star2; images[2] = Properties.Resources.star3; images[3] = Properties.Resources.star4; break; default: break; } }
public static IEnumerable<string> GenerateImageList(InvaderType invaderType) { string fileName = ""; List<string> imageNames = new List<string>(); switch (invaderType) { case InvaderType.Bug: fileName = "bug"; break; case InvaderType.Mothership: fileName = "Mothership"; break; case InvaderType.Saucer: fileName = "flyingsaucer"; break; case InvaderType.Satellite: fileName = "satellite"; break; case InvaderType.Spaceship: fileName = "spaceship"; break; case InvaderType.Star: fileName = "star"; break; default: break; }; if (!string.IsNullOrEmpty(fileName)) { int numImages = 4; if (invaderType == InvaderType.Mothership) numImages = 3; for (int i = 1; i <= numImages; i++) { imageNames.Add(fileName + i + ".png"); } } return imageNames; }
public static IEnumerable <string> CreateInvaderImageList(InvaderType invaderType) { string fileName = ""; List <string> imageNames = new List <string>(); switch (invaderType) { case InvaderType.Bug: fileName = "bug"; break; case InvaderType.Saucer: fileName = "flyingsaucer"; break; case InvaderType.Satellite: fileName = "satellite"; break; case InvaderType.Spaceship: fileName = "spaceship"; break; case InvaderType.Star: fileName = "star"; break; default: break; } if (!string.IsNullOrEmpty(fileName)) { int numImages = 4; for (int i = 1; i <= numImages; i++) { imageNames.Add(fileName + i + ".png"); } } return(imageNames); }
public void Initialize(ushort health, InvaderType type) { // do stuff with health bar? mMaxHealth = CurrentHealth = health; CanBeUsed = true; HealthBar.Initialize(mMaxHealth); switch (type) { case (InvaderType.Archer): Image.sprite = ArcherImage; break; case (InvaderType.Soldier): Image.sprite = SoldierImage; break; case (InvaderType.Healer): Image.sprite = HealerImage; break; } }
IEnumerator LoadInvadersSlowly() { invadersSpawningFinished = false; GameManager.Instance.PauseGame(); WaitForSeconds sec = new WaitForSeconds(0.03f); aliveInvaders = new bool[xSize, ySize]; aliveColumns = new List <int>(xSize); for (int i = 0; i < xSize; i++) { //aliveColumns[i] = i; aliveColumns.Add(i); } currentAttackStyle = attackStyles[0]; float yPos = yOffset + transform.position.y; for (int y = 0; y < ySize; y++) { float xPos = xOffset + transform.position.x; InvaderType type = SelectType(y); for (int x = 0; x < xSize; x++) { CreateInvader(xPos, yPos, type, x, y); yield return(sec); aliveInvaders[x, y] = true; xPos = xPos + xCellSize; } yPos = yPos + yCellSize; } currentInvaderCount = TotalInvaderCount; invadersSpawningFinished = true; GameManager.Instance.UnpauseGame(); }
public static IEnumerable <string> CreateImageList(InvaderType invaderType) { string filename; switch (invaderType) { case InvaderType.Bug: filename = "bug"; break; case InvaderType.Satellite: filename = "satellite"; break; case InvaderType.Saucer: filename = "flyingsaucer"; break; case InvaderType.Spaceship: filename = "spaceship"; break; case InvaderType.Star: filename = "star"; break; default: throw new ArgumentException(nameof(invaderType)); } var nameList = new List <string>(); for (var index = 1; index <= 4; index++) { nameList.Add(filename + index + ".png"); } nameList.Add(filename + "1.png"); return(nameList); }
public Invader(Point location, Size size, InvaderType type, int score) : base(location, size) { InvaderType = type; Score = score; }
public Invader(InvaderType invaderType, Point location, int score) : base(location, Invader.InvaderSize) { this.InvaderType = invaderType; this.Score = score; }
public void Init(InvaderType type, int xIndex, int yIndex) { this.invaderType = type; this.xIndex = xIndex; this.yIndex = yIndex; }
public Invader(InvaderType type, Point location) { this.Type = type; this.Location = location; hitboxSize = InvaderImage(0).Size; }
public Invader(InvaderType invaderType, int score, Point location, Size size) : base(location, size) { InvaderType = invaderType; Score = score; }
public Invader(int score, InvaderType type) : base(new Point(), InvaderSize) { Score = score; Type = type; }
public Invader(Point location, InvaderType invaderType, int score) : base(location, InvaderSize) { InvaderType = invaderType; Score = score; }
public Invader(InvaderType invaderType, Point location, int score) : base(location, InvaderSize) { InvaderType = invaderType; Score = score; }
public Invader(Point location, InvaderType invaderType, BitmapSource texture) : base(location, InvaderSize, texture) { InvaderType = invaderType; }
public Invader(InvaderType type, Point location, int score) : base(location, Invader.InvaderSize) { InvaderType = type; Score = score; }
public Invader(InvaderType invaderType, Point location, int score) : base(InvaderSize, location) { Score = score; InvaderType = invaderType; }