public void PlacePowerUp(uint GridIndex, string WhichGrid = "Both", POWERUP_TYPE powerType = POWERUP_TYPE.TOTAL_POWERUPS) { if (WhichGrid == "Player" || WhichGrid == "Both") { PlayerGridPowerups.Add(new PowerUp(theGridSystem.grid[GridIndex].transform.position, powerType)); //Store the sprites into the object PlayerGridPowerups[PlayerGridPowerups.Count - 1].StoreSprites(moveSpeedSprite, attackSpeedSprite, attackDamageSprite); //Init the image object in powerup class PlayerGridPowerups[PlayerGridPowerups.Count - 1].PowerUpTexture = Instantiate(SampleImage); //Decides the powerup modifiers based on powertype PlayerGridPowerups[PlayerGridPowerups.Count - 1].AssignType(); //Change the position of powerup PlayerGridPowerups[PlayerGridPowerups.Count - 1].ChangePosition(); } if (WhichGrid == "Enemy" || WhichGrid == "Both") { EnemyGridPowerups.Add(new PowerUp(theEnemyGridSystem.grid[GridIndex].transform.position, powerType)); //Store the sprites into the object EnemyGridPowerups[EnemyGridPowerups.Count - 1].StoreSprites(moveSpeedSprite, attackSpeedSprite, attackDamageSprite); //Init the image object in powerup class EnemyGridPowerups[EnemyGridPowerups.Count - 1].PowerUpTexture = Instantiate(SampleImage); //Decides the powerup modifiers based on powertype EnemyGridPowerups[EnemyGridPowerups.Count - 1].AssignType(); //Change the position of powerup EnemyGridPowerups[EnemyGridPowerups.Count - 1].ChangePosition(); } }
public void SetRandomType() { int ranNum = (int)((Random.value * 0.99f) * 3); switch (ranNum) { case 0: type = POWERUP_TYPE.DAMAGE_ALL; spriteRenderer.sprite = sprites[2]; break; case 1: type = POWERUP_TYPE.FAST; spriteRenderer.sprite = sprites[0]; break; case 2: type = POWERUP_TYPE.TRIPPLE; spriteRenderer.sprite = sprites[1]; break; } }
public List <Piece> ExecutePowerup(POWERUP_TYPE type, Piece p) { if (type == POWERUP_TYPE.ONE_LINE_PW) { return(MatchController.ME.ExecutePowerup(new OneLinePw().ExecutePowerup(p))); } if (type == POWERUP_TYPE.ONE_COLLUMN_PW) { return(MatchController.ME.ExecutePowerup(new OneCollumnPw().ExecutePowerup(p))); } if (type == POWERUP_TYPE.ONE_TYPE_PW) { return(MatchController.ME.ExecutePowerup(new OneTypePw().ExecutePowerup(p))); } return(null); }
public void SpawnPowerUp(Vector3 position, POWERUP_TYPE powerupType = POWERUP_TYPE.POWERUP_RANDOM) { GameObject PowerupObj = null; if (powerupType == POWERUP_TYPE.POWERUP_RANDOM) { powerupType = (POWERUP_TYPE)Random.Range(0, (float)POWERUP_TYPE.TOTAL_POWERUPS - 1); } if (powerupType == POWERUP_TYPE.POWERUP_HEALTH) { PowerupObj = Instantiate(Resources.Load("HealthPowerup") as GameObject, position, gameObject.transform.rotation, gameObject.transform); } else if (powerupType == POWERUP_TYPE.POWERUP_INVINCIBILITY) { PowerupObj = Instantiate(Resources.Load("InvincibilityPowerup") as GameObject, position, gameObject.transform.rotation, gameObject.transform); } PowerupObj.GetComponent <RectTransform>().position = position; }