예제 #1
0
        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);
        }
예제 #2
0
 public Asteroid(float x, float y, AsteroidTypes t)
 {
     position.X = x;
     position.Y = y;
     setVelocity();
     type = t;
 }
예제 #3
0
 // 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();
 }
예제 #4
0
        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);
        }
예제 #5
0
        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;
        }
예제 #6
0
 public bool IsAsteroid()
 {
     return(AsteroidTypes.Contains(TypeOfObject));
 }