public void HandleChildAsteroid(AsteroidTypes asteroidType, AsteroidSize asteroidSize, Vector3 startPosition) { var childAsteroid = asteroidSize == AsteroidSize.Large ? AsteroidSize.Medium : AsteroidSize.Small; GenerateChildAsteroid(asteroidType, childAsteroid, startPosition); GenerateChildAsteroid(asteroidType, childAsteroid, startPosition); }
public Asteroid(float x, float y, AsteroidTypes t) { position.X = x; position.Y = y; setVelocity(); type = t; }
// Use this for initialization private void Awake() { if (Random.Range(1, 100) > 80) { at = AsteroidTypes.Energy; GetComponentInChildren <MeshRenderer>().material.color = Color.red; return; } at = AsteroidTypes.Simple; Destrotasteroids(); }
private void GenerateChildAsteroid(AsteroidTypes asteroidType, AsteroidSize asteroidSize, Vector3 startPosition) { var childAsteroid = asteroidSize == AsteroidSize.Large ? AsteroidSize.Medium : AsteroidSize.Small; var asteroid = AsteroidsPooler.currentInstance.GetAsteroid(childAsteroid); if (asteroid == null) { return; } ActiveAsteroid(asteroidType, asteroidSize, startPosition); }
private void ActiveAsteroid(AsteroidTypes asteroidType, AsteroidSize asteroidSize, Vector3 startPosition) { var asteroidTypeItem = asteroidSpritesRepository.asteroidTypeDictionary[asteroidType]; var asteroidTypeSizeItem = asteroidTypeItem.asteroidsTypeSizeItems[asteroidSize]; var asteroidSprite = asteroidTypeSizeItem.asteroidSprite; var asteroid = AsteroidsPooler.currentInstance.GetAsteroid(asteroidSize); var asteroidTransform = asteroid.gameObject.transform; asteroidTransform.localPosition = startPosition; var baseAsteroid = asteroid.GetComponent <BaseAsteroid>(); asteroid.SetActive(true); baseAsteroid.asteroidType = asteroidType; baseAsteroid._spriteRenderer.sprite = asteroidSprite; }
public bool IsAsteroid() { return(AsteroidTypes.Contains(TypeOfObject)); }