Exemple #1
0
 public StoreInfo(int cost, int unlockedAfterLevel, ExplosionType explosionType, string description)
 {
     this.cost = cost;
     this.unlockedAfterLevel = unlockedAfterLevel;
     this.explosionType      = explosionType;
     this.description        = description;
 }
Exemple #2
0
//	void InitExplosionsPool ()
//	{
//		pooledExplosions = new Dictionary<ExplosionType, List<GameObject>>();
//		for (int i=0; i< explosionTypes.Count; i++)
//		{
//			List<GameObject> poolList = new List<GameObject>();
//			Explosion explosion = null;
//			if (explosionDataBase.TryGetValue ((ExplosionType)i, out explosion))
//				GameObject currenPrefab = explosionTypes[i].Prefab;
//			ExplosionType currentType = explosionTypes[i].Type;
//			int currentAmount = explosionTypes[i].PoolAmount;
//
//			for (int a = 0; a < currentAmount; a++)
//			{
//				AddNewToPool (poolList, );
//			}
//
//		}
//	}

    void InitExplosionsPool()
    {
        pooledExplosions = new Dictionary <ExplosionType, List <GameObject> >();
        for (int i = 0; i < explosionTypes.Count; i++)
        {
            List <GameObject> poolList  = new List <GameObject>();
            Explosion         explosion = null;
            if (explosionDataBase.TryGetValue(((ExplosionType)i), out explosion))
            {
                GameObject    currenPrefab  = explosionTypes[i].Prefab;
                ExplosionType currentType   = explosionTypes[i].Type;
                int           currentAmount = explosionTypes[i].PoolAmount;

                for (int a = 0; a < currentAmount; a++)
                {
                    AddNewObjectToPool(poolList, explosion);
//					Debug.Log ("instantiated");
                }
                pooledExplosions.Add((ExplosionType)i, poolList);                               // add to PoolList to Dictionary
            }
            else
            {
                Debug.LogError(i + " (" + ((ExplosionType)i) + ") not found in DataBase");
            }
        }
    }
    public void Explode(Vector3 position, ExplosionType type)
    {
        GameObject explosion = null;

        switch (type)
        {
        case ExplosionType.SMALL:
            explosion = Instantiate(explosionS).gameObject;
            Instantiate(residue).GetComponent <Transform>().position = position;
            break;

        case ExplosionType.LARGE:
            explosion = Instantiate(explosionL).gameObject;
            break;

        case ExplosionType.FLOOR:
            explosion = Instantiate(explosionS).gameObject;
            break;

        case ExplosionType.CUBE:
            explosion = Instantiate(explosionCube).gameObject;
            break;

        case ExplosionType.SOFT:
            explosion = Instantiate(explosionSoft).gameObject;
            break;

        case ExplosionType.HARD:
            explosion = Instantiate(explosionHard).gameObject;
            break;
        }
        explosion.transform.position = position;
    }
Exemple #4
0
//	public GameObject GetPooledObject (Explosion explosion) {
//
//		List<GameObject> explosions;
//		if (pooledExplosions.TryGetValue(explosion.Type, out explosions))
//		{
//			GetInactivObject (explosion, explosion.CanGrow);
//		}
//
//
//	}

    public GameObject GetPooledObject(ExplosionType type)
    {
        List <GameObject> explosions;

        Explosion explosion = null;

        if (explosionDataBase.TryGetValue(type, out explosion))
        {
            if (pooledExplosions.TryGetValue(type, out explosions))
            {
                GameObject inactivGO = GetInactivObject(explosions, explosion);
                if (inactivGO != null)
                {
                    return(inactivGO);
                }
                else
                {
                    Debug.LogError("all Pooled Objects are activ, increase pool Amount of " + type.ToString());
                }
            }
            else
            {
                Debug.LogError(type.ToString() + " is not pooled");
            }
        }
        else
        {
            Debug.LogError(type.ToString() + " is not in explosionDataBase!");
        }
        return(null);
    }
 public Explosion_Img(ExplosionType explosionType)
 {
     if (explosionType == ExplosionType.nuke)
     {
         for (int i = 0; i < 9; i++)
         {
             int n = i + 1;
             imgs.Add(Image.FromFile(@"resourcesnew/explosions/nuke_explosion/explosion0" + n + ".png"));
         }
         for (int i = 9; i < 50; i++)
         {
             int n = i + 1;
             imgs.Add(Image.FromFile(@"resourcesnew/explosions/nuke_explosion/explosion" + n + ".png"));
         }
     }
     else if (explosionType == ExplosionType.small)
     {
         for (int i = 0; i < 9; i++)
         {
             int n = i + 1;
             imgs.Add(Image.FromFile(@"resourcesnew/explosions/small_explosion/explosion0" + n + ".png"));
         }
         for (int i = 9; i < 31; i++)
         {
             int n = i + 1;
             imgs.Add(Image.FromFile(@"resourcesnew/explosions/small_explosion/explosion" + n + ".png"));
         }
     }
 }
Exemple #6
0
    private IEnumerator PlayExplosion(ExplosionType ext)
    {
        hitTarget           = true;
        _bulletMesh.enabled = false;
        _shellMesh.enabled  = false;
        switch (ext)
        {
        case ExplosionType.Small:
            _smallExplosion.SetActive(true);
            yield return(new WaitForSeconds(2f));

            _smallExplosion.SetActive(false);
            break;

        case ExplosionType.Big:
            _bigExplosion.SetActive(true);
            yield return(new WaitForSeconds(3f));

            _bigExplosion.SetActive(false);
            break;

        default:
            break;
        }
        Destroy(gameObject);
    }
Exemple #7
0
 public bool Equals(ExplosionType obj)
 {
     if (obj == null)
     {
         return(false);
     }
     return(obj.swigCPtr.Handle == this.swigCPtr.Handle);
 }
Exemple #8
0
        public void CreateExplosion(ExplosionType explosionType, Vector3 position = default(Vector3), float radius = default(float), float fadeSpeed = 0.1f, float startAlpha = 1f, float delay = 0)
        {
            position = position == default(Vector3) ? this._worldPosition : position;
            radius   = radius == default(float) ? this.HitRadius * 0.9f : radius;
            var explosion = InitiateExplosion(explosionType, position, radius, fadeSpeed, startAlpha, delay);

            explosion.StartFade();
        }
        /// <summary>
        /// Creates an instance of an empty ExplodeAnim animator
        /// </summary>
        /// <param name="initialType">The initial explosion type of this animator</param>
        /// <param name="initialSlideInterval">The interval between frames to use for this animator</param>
        /// <param name="bounds">The bounds and position of this explosion animator, bounds are primarily used for the RANDOM type</param>
        public ExplodeAnim(ExplosionType initialType, float initialSlideInterval, Rectangle bounds)
        {
            _explosionList = new List <ExplosionSet>();

            _universalSlideInterval = initialSlideInterval;
            _bounds          = bounds;
            _myExplosionType = initialType;
        }
    public void Attack(bool isMoving, bool attack)
    {
        //creates a projectile clone
        if (attack && (attackTime <= Time.time && !isCreated))
        {
            if (!isPrefabLoaded)
            {
                projectilePrefab = ProjectileProcessor.GetPrefab(chosenProjectile);
                projectileName   = ProjectileProcessor.GetProjectileName();
                isPrefabLoaded   = true;
            }

            //set the shotgun location to attackhandsource
            if (projectileName == "Shotgun")
            {
                projectile = Instantiate(projectilePrefab, attackHandSource.position,
                                         attackHandSource.rotation);
            }
            else
            {
                projectile = Instantiate(projectilePrefab, attackSource.position,
                                         attackSource.rotation);
            }

            //creates the projectile
            projectileScript = projectile.GetComponent <ProjectileManager>();

            //updates and fetches projectile's data
            projectileScript.SetPlayerMoving(isMoving);
            fireRate    = fireRates[projectileScript.GetName()];
            explodeType = projectileScript.GetExplosionType();

            //updates the attack time
            attackTime = fireRate + Time.time;

            //start waiting if it's a detonation projectile
            if (explodeType == ExplosionType.Detonate)
            {
                coro      = projectileScript.coro;
                isCreated = true;
            }
        }

        //detonate the projectile using the button
        else if (attack && projectileScript != null && isCreated)
        {
            StopCoroutine(coro);
            projectileScript.DetonateProjectile();
            isCreated = false;
        }

        //if the projectile exploded on its own
        else if (projectileScript == null && isCreated)
        {
            isCreated = false;
        }
    }
Exemple #11
0
    public void CreateExplosionFor(
        IEnumerable <Player> players,
        Vector3 position,
        ExplosionType type,
        Player?responsiblePlayer = null
        )
    {
        var packet = new ExplosionPacket(responsiblePlayer?.Id, null, position, (byte)type, (ushort)(responsiblePlayer?.Client.Ping ?? 0));

        packet.SendTo(players);
    }
        public Explosion(float x, float y, ExplosionType explosionType)
            : base(x, y)
        {
            Explosion_Img eim = new Explosion_Img(explosionType);

            imgs               = eim.get_Explosion_imgs();
            Drawed_img         = imgs[0];
            base.Height        = Drawed_img.Height;
            base.Width         = Drawed_img.Width;
            this.explosionType = explosionType;
        }
        /// <summary>
        /// Creates an ExplodeAnim animator
        /// </summary>
        /// <param name="initialExplosionSet">The initial set to use for an explosion, the position of this will be set to the bounds</param>
        /// <param name="initialType">The initial explosion type of this animator</param>
        /// <param name="initialSlideInterval">The interval between frames to use for this animator</param>
        /// <param name="bounds">The bounds and position of this explosion animator, bounds are primarily used for the RANDOM type</param>
        public ExplodeAnim(ExplosionSet initialExplosionSet, ExplosionType initialType, float initialSlideInterval, Rectangle bounds)
        {
            _explosionList = new List <ExplosionSet>();

            _universalSlideInterval = initialSlideInterval;
            _bounds          = bounds;
            _myExplosionType = initialType;

            initialExplosionSet.Position = new Vector2(bounds.X, bounds.Y);

            AddExplosion(initialExplosionSet, Vector2.Zero);
        }
Exemple #14
0
 public override void OnExplosionEvent(IPlayer sourcePlayer, ExplosionType explosionType, Position position,
                                       uint explosionFx)
 {
     base.OnExplosionEvent(sourcePlayer, explosionType, position, explosionFx);
     if (!ExplosionAsyncEventHandler.HasEvents())
     {
         return;
     }
     Task.Run(() =>
              ExplosionAsyncEventHandler.CallAsyncWithoutTask(@delegate =>
                                                              @delegate(sourcePlayer, explosionType, position, explosionFx)));
 }
Exemple #15
0
        protected virtual ExplosionBehavior InitiateExplosion(ExplosionType explosionType, Vector3 position, float radius, float fadeSpeed = 0.1f, float startAlpha = 1f, float delay = 0)
        {
            var explosion = Instantiate(Util.LoadExplosion(explosionType), position, Quaternion.identity) as GameObject;
            var component = explosion.GetComponent <ExplosionBehavior>();

            explosion.transform.localScale = new Vector3(radius * 2, radius * 2);
            component.FadeSpeed            = fadeSpeed;
            component.FadeDelay            = delay;
            component.SetStartAlpha(startAlpha);
            Util.AssignObjectParent("Explosions", explosion);
            return(component);
        }
Exemple #16
0
        private void PlaySound(ExplosionType type)
        {
            switch (type)
            {
            case ExplosionType.One:
                soundOne.Play();
                break;

            case ExplosionType.Two:
                soundOne.Play();
                break;
            }
        }
Exemple #17
0
 public Explosion(Vector2D position, ExplosionType type)
 {
     this.PlaySound(type);
     this.Position = position;
     this.anim     = new Animation(new Image[]
     {
         StaticImages.Sprites[GameSprites.ExplosionSprites.StageOne],
         StaticImages.Sprites[GameSprites.ExplosionSprites.StageTwo],
         StaticImages.Sprites[GameSprites.ExplosionSprites.StageThree],
         StaticImages.Sprites[GameSprites.ExplosionSprites.StageFour],
         StaticImages.Sprites[GameSprites.ExplosionSprites.StageFive],
         StaticImages.Sprites[GameSprites.ExplosionSprites.StageSix]
     }, 0.1);
 }
Exemple #18
0
        public static Explosion Create(int playerId, ExplosionType type)
        {
            switch (type)
            {
            case ExplosionType.T10:
                return(new Explosion(playerId, 100f, 70f));

            case ExplosionType.KL50:
                return(new Explosion(playerId, 170f, 50f));

            case ExplosionType.IU7:
                return(new Explosion(playerId, 160f, 100f));
            }

            return(default);
Exemple #19
0
        public ExplosionEffectSphere SpawnExplosion(ExplosionType explosionType, Vector3 position, float targetRadius, float forceAtEdge, float minimumForce, float rtDuration, DamagePackage damage)
        {
            //Debug.Log ("Spawning explosion... with effects");
            GameObject            explosionEffectSphereObject = GameObject.Instantiate(ExplosionEffectSpherePrefab, position, Quaternion.identity) as GameObject;
            ExplosionEffectSphere explosionEffectSphere       = explosionEffectSphereObject.GetComponent <ExplosionEffectSphere> ();

            explosionEffectSphere.ExplosionDamage = damage;
            explosionEffectSphere.ForceAtEdge     = forceAtEdge;
            explosionEffectSphere.MinimumForce    = minimumForce;
            explosionEffectSphere.RTDuration      = rtDuration;       //Mathf.Max (rtDuration, (Time.fixedDeltaTime * 2));//make sure it has 2 ticks to capture items

            SpawnExplosionFX(explosionType, null, position);

            return(explosionEffectSphere);
        }
    public void MakeExplosion(ExplosionType type, Vector2 position, int damageRatio)
    {
        if (_player == null || _enemy == null)
        {
            return;
        }

        var explosionObject = Resources.Load("Prefabs/Explosion");
        var instance        = Instantiate(explosionObject) as GameObject;

        var explosionPosition = new Vector3(position.x, position.y, 0);

        instance.transform.position = explosionPosition;

        instance.GetComponent <Explosion>().Init(type, _player, _enemy, damageRatio);
    }
		public void Show(ExplosionType type)
		{
			if (_animator != null)
			{
				switch (type)
				{
					case ExplosionType.Bullet:
						_animator.Play(AnimBullet.name);
						break;
					case ExplosionType.Object:
						_animator.Play(AnimObject.name);
						break;
				}
				_animator.enabled = true;
			}
		}
        public void Show(ExplosionType type)
        {
            if (_animator != null)
            {
                switch (type)
                {
                case ExplosionType.Bullet:
                    _animator.Play(AnimBullet.name);
                    break;

                case ExplosionType.Object:
                    _animator.Play(AnimObject.name);
                    break;
                }
                _animator.enabled = true;
            }
        }
Exemple #23
0
        public override void OnExplosionEvent(IPlayer sourcePlayer, ExplosionType explosionType, Position position,
                                              uint explosionFx)
        {
            base.OnExplosionEvent(sourcePlayer, explosionType, position, explosionFx);
            if (!ExplosionAsyncEventHandler.HasEvents())
            {
                return;
            }
            var sourceReference = new PlayerRef(sourcePlayer);

            Task.Run(async() =>
            {
                await ExplosionAsyncEventHandler.CallAsync(@delegate =>
                                                           @delegate(sourcePlayer, explosionType, position, explosionFx));
                sourceReference.Dispose();
            });
        }
Exemple #24
0
    public void Init(ExplosionType explosionType, GameObject player, GameObject enemy, int damageRatio)
    {
        #region SPEC LOAD

        if (_explosionTypeToSpecPath.ContainsKey(explosionType) == false)
        {
            Debug.LogAssertionFormat("Invalid Dictionay Data Path - {0]", explosionType);
            return;
        }

        var path = _explosionTypeToSpecPath[explosionType];
        var text = Resources.Load <TextAsset>(path).text;
        _spec = ExplosionSpec.CreateFromText(text);

        #endregion

        #region MAKE EFFECT

        _explosion = Instantiate(Resources.Load(_spec._prefabPath)) as GameObject;
        _explosion.transform.position = this.transform.position;
        _explosion.transform.SetParent(this.transform);

        #endregion

        #region COLLISION DETECT

        var damage = (int)(_spec._minDamage + (_spec._maxDamage - _spec._minDamage) * damageRatio / 100);

        if (GetExplosionCollision(_spec, player, this.transform.position))
        {
            player.GetComponent <Player>().Damaged(damage);
        }

        if (GetExplosionCollision(_spec, enemy, this.transform.position))
        {
            enemy.GetComponent <Player>().Damaged(damage);
        }

        #endregion

        #region DELETE SELF

        Destroy(this.gameObject, 3f);

        #endregion
    }
Exemple #25
0
        public void SpawnExplosionFX(ExplosionType explosionType, Transform explosionParent, Vector3 position)
        {
            GameObject prefab             = mExplosionLookup [explosionType];
            GameObject instantiatedPrefab = null;

            if (explosionParent != null)
            {
                instantiatedPrefab = GameObject.Instantiate(prefab) as GameObject;
                instantiatedPrefab.transform.parent        = explosionParent;
                instantiatedPrefab.transform.localPosition = position;
            }
            else
            {
                instantiatedPrefab = GameObject.Instantiate(prefab, position, Quaternion.identity) as GameObject;
            }
            //Debug.Log ("instantiated prefab " + prefab.name + " in spawn explosionFX");
        }
Exemple #26
0
        // constructor, defining explosion characteristics
        // _pos = center point of explosion
        // size = diameter
        // _expansionSpeed = how fast explosion should reach max size
        // _duration = how long explosion should last once reached max size (before contracting)
        public Explosion(GameSettings _settings, ExplosionType _type, Point _pos)
        {
            settings = _settings;
            type     = _type;

            state = ExplosionState.Expanding;

            // create list for shapes
            shapes = new List <Shape>();

            // create shape
            explosionShape = new Ellipse();
            shapes.Add(ExplosionShape);

            // set specifics according to explosion type
            if (type == ExplosionType.Impact)
            {
                // explosion properties
                size     = settings.ImpactExplosionInitialSize;
                maxSize  = settings.ImpacExplosionMaxSize;
                speed    = settings.ImpacExplosionSpeed;
                duration = settings.ImpacExplosionDuration;
                // shape colors
                explosionShape.Stroke = settings.BrushStrokeImpactExplosion;
                explosionShape.Fill   = settings.BrushFillImpactExplosion;
            }
            else
            {
                // explosion properties
                size     = settings.AirExplosionInitialSize;
                maxSize  = settings.AirExplosionMaxSize;
                speed    = settings.AirExplosionSpeed;
                duration = settings.AirExplosionDuration;
                // shape colors
                explosionShape.Stroke = settings.BrushStrokeAirExplosion;
                explosionShape.Fill   = settings.BrushFillAirExplosion;
            }

            // center point correctly (top left)
            pos = new Point(_pos.X - size / 2, _pos.Y - size / 2);

            explosionShape.Height = size;
            explosionShape.Width  = size;
        }
Exemple #27
0
    void Awake()
    {
        //adds component
        s_Projectile = ProjectileProcessor.ConfigureComponent(gameObject);
        //activates delayed detonation for some projectiles
        ExplosionType explodeType = GetExplosionType();

        if (explodeType == ExplosionType.Delay ||
            explodeType == ExplosionType.Detonate)
        {
            coro = StartCoroutine(WaitUntilDetonate());
        }

        //instantly explode this one because why not
        else if (explodeType == ExplosionType.Instant)
        {
            ExplodeProjectile();
        }
    }
Exemple #28
0
        public void AddExplosion(int explosion, Vector2 loc)
        {
            ExplosionType type = (ExplosionType)explosion;

            explosionId++;
            explosionListSize++;
            switch (type)
            {
            case ExplosionType.SwordExplode:
                Physics tempPhysics = new Physics(loc)
                {
                    CurrentDirection = Physics.Direction.NorthEast
                };
                explosionList.Add(explosionId, new SwordBeamExplosion(tempPhysics));
                explosionId++;
                explosionListSize++;
                tempPhysics = new Physics(loc)
                {
                    CurrentDirection = Physics.Direction.NorthWest
                };
                explosionList.Add(explosionId, new SwordBeamExplosion(tempPhysics));
                explosionId++;
                explosionListSize++;
                tempPhysics = new Physics(loc)
                {
                    CurrentDirection = Physics.Direction.SouthEast
                };
                explosionList.Add(explosionId, new SwordBeamExplosion(tempPhysics));
                explosionId++;
                explosionListSize++;
                tempPhysics = new Physics(loc)
                {
                    CurrentDirection = Physics.Direction.SouthWest
                };
                explosionList.Add(explosionId, new SwordBeamExplosion(tempPhysics));
                break;

            case ExplosionType.BombExplode:
                explosionList.Add(explosionId, new BombExplosion(loc));
                break;
            }
        }
        /// <summary>
        /// Constructor for the Explosion class
        /// </summary>
        /// <param name="coordinate">The coordinate for the explosion</param>
        /// <param name="explosionType">The type of explosion</param>
        public Explosion(Vector2 coordinate, ExplosionType explosionType)
        {
            // Instantiate a new timer
            timer = new Timer(2);

            // Set the coordinates
            coordinates = coordinate;

            // Decrease the X coordinate by 1
            // Makes the explosion sprite fit better
            coordinates.X--;

            // Set the animation frame to 0
            animation = 0;

            // Set the type of explosion
            type = explosionType;

            // Set the explosion sprites
            SetSprites();
        }
Exemple #30
0
    public void CreateExplosion(Vector3 pos, ExplosionType type = ExplosionType.Default)
    {
        Debug.Log("Explosion");
        string path = "Explosions/";

        if (type == ExplosionType.Floor)
        {
            //Mud
            switch (MapType.Meadow)
            {
            case MapType.Meadow:
                path += "MudExplosion";
                break;

            case MapType.Desert:
                path += "SandExplosion";
                break;

            case MapType.Snow:
                path += "SnowExplosion";
                break;
            }
        }
        else if (type == ExplosionType.Wood)
        {
            path += "WoodExplosion";
        }
        else if (type == ExplosionType.Tank)
        {
            path += "TankExplosion";
        }
        else
        {
            path += "Explosion";
        }

        GameObject explosion = Instantiate(Resources.Load(path), pos, new Quaternion(0, 0, 0, 0)) as GameObject;

        Destroy(explosion, 0.5f);
    }
Exemple #31
0
        public Explosion(Game game, float x, float y, ExplosionType type)
            : base(game, 0, "explosion")
        {
            X = x;
            Y = y;
            _animSpeed = 4f;
            _type = type;

            switch (_type) {

            case ExplosionType.Smoky:
                _template = new SpriteTemplate () { TilemapName = "units", Rectangle = new Rectangle(0, 832, 96, 96) };
                _frameCount = 16;
                _animSpeed = 4f;
                _lifeTime = -6;
                break;
            }

            _sprite = new Sprite(_template, 0, Priority.Explosion);
            _sprite[0].Angle = (ushort)Util.RandomInt(0,4095);
            _sprite[0].Scale = Util.Random(0.6f, 1.0f);
        }
Exemple #32
0
        public void Explode(ExplosionType type, Vector3 position)
        {
            for (int i = 0; i < explosions.Length; i++)
            {
                BaseExplosion currentExplosion = explosions[i];

                if (currentExplosion.ExplosionType == type)
                {
                    var clone = PoolManager.SpawnObject(currentExplosion.ParticleSysPrefab);
                    if (clone == null)
                    {
                        return;
                    }
                    ParticleSystem ps = clone.GetComponent <ParticleSystem>();
                    ps.transform.position = position;

                    currentExplosion.ExplosionFinished += (s, e) => ExplosionDie(clone);
                    currentExplosion.Explode(currentExplosion.SoundFX, ps, position);
                    return;
                }
            }
        }
Exemple #33
0
        public Explosion(Texture2D texture, ExplosionType thisType, Vector2 position)
        {
            type = thisType;

            xPos = (int)position.X;
            yPos = (int)position.Y;

            health = 1;
            maxHealth = 1;

            switch (type)
            {
                case ExplosionType.Basic:
                    {
                        animDie = new List<Rectangle>
                        {
                            new Rectangle(0, 0, 24, 27),
                            new Rectangle(24, 0, 24, 27),
                            new Rectangle(48, 0, 24, 27),
                            new Rectangle(72, 0, 24, 27),
                            new Rectangle(96, 0, 24, 27),
                            new Rectangle(0, 27, 24, 27),
                            new Rectangle(24, 27, 24, 27),
                            new Rectangle(48, 27, 24, 27),
                            new Rectangle(72, 27, 24, 27),
                            new Rectangle(96, 27, 24, 27),
                            new Rectangle(120, 27, 24, 27),
                            new Rectangle(144, 27, 24, 27)
                        };

                        break;

                    }
                case ExplosionType.Huge:
                case ExplosionType.Tiny:
                default:
                    {
                        // this data is for the Tiny explosion
                        // ideally this would be stored in an external file
                        animDie = new List<Rectangle>
                        {
                            // TODO: see if we can fix these
                            new Rectangle(72, 84, 12, 13),              // #1
                            new Rectangle(84, 84, 12, 13),
                            new Rectangle(96, 84, 12, 13),              // #3
                            new Rectangle(108, 84, 12, 13),
                            new Rectangle(120, 84, 12, 13),             // #5
                            new Rectangle(132, 84, 12, 13),
                            new Rectangle(144, 84, 12, 13),             // #7
                            new Rectangle(156, 84, 12, 13),
                            new Rectangle(168, 84, 12, 13),             // #9
                            new Rectangle(180, 84, 12, 13),
                            new Rectangle(192, 84, 12, 13),             // #11
                            new Rectangle(204, 84, 12, 13),
                            new Rectangle(212, 84, 12, 13),             // #13

                        };

                        break;
                    }
            }

            maxFrames = animDie.Count();            // get the number of frames programmatically

            frameNumber = 0;            // start with the 1st frame
            sprite = new Sprite(texture, animDie[frameNumber], 2.0);
        }
Exemple #34
0
        /// <summary>
        /// Creates an instance of an empty ExplodeAnim animator
        /// </summary>
        /// <param name="initialType">The initial explosion type of this animator</param>
        /// <param name="initialSlideInterval">The interval between frames to use for this animator</param>
        /// <param name="bounds">The bounds and position of this explosion animator, bounds are primarily used for the RANDOM type</param>
        public ExplodeAnim(ExplosionType initialType, float initialSlideInterval, Rectangle bounds)
        {
            _explosionList = new List<ExplosionSet>();

            _universalSlideInterval = initialSlideInterval;
            _bounds = bounds;
            _myExplosionType = initialType;
        }
Exemple #35
0
        /// <summary>
        /// Creates an ExplodeAnim animator
        /// </summary>
        /// <param name="initialExplosionSet">The initial set to use for an explosion, the position of this will be set to the bounds</param>
        /// <param name="initialType">The initial explosion type of this animator</param>
        /// <param name="initialSlideInterval">The interval between frames to use for this animator</param>
        /// <param name="bounds">The bounds and position of this explosion animator, bounds are primarily used for the RANDOM type</param>
        public ExplodeAnim(ExplosionSet initialExplosionSet, ExplosionType initialType, float initialSlideInterval, Rectangle bounds)
        {
            _explosionList = new List<ExplosionSet>();

            _universalSlideInterval = initialSlideInterval;
            _bounds = bounds;
            _myExplosionType = initialType;

            initialExplosionSet.Position = new Vector2(bounds.X, bounds.Y);

            AddExplosion(initialExplosionSet, Vector2.Zero);
        }
Exemple #36
0
 public Explosion(Vector3 position, byte index, ExplosionType type)
 {
     Position = position;
     Index = index;
     ExplosionType = type;
 }
Exemple #37
0
 public ExplosionType explosionType() {
   ExplosionType ret = new ExplosionType(bwapiPINVOKE.WeaponType_explosionType(swigCPtr), true);
   return ret;
 }
        private void AddExplosion(Vector2 position, ExplosionType type)
        {
            AnimationSprite temp;
            switch (type)
            {
                case ExplosionType.Big:
                    temp = new AnimationSprite(_explosionTextures[0],16);
                    break;
                case ExplosionType.Medium:
                    temp = new AnimationSprite(_explosionTextures[1], 16);
                    break;
                case ExplosionType.Bullet:
                    temp = new AnimationSprite(_explosionTextures[3], 16);
                    break;
                case ExplosionType.BulletUfo:
                    temp = new AnimationSprite(_explosionTextures[4], 16);
                    break;
                default:
                    temp = new AnimationSprite(_explosionTextures[2], 16);
                    break;
            }
            temp.Position = position;

            temp.Rotation = _random.Next(-6, 6);
            temp.Create();
            _explosions.Add(temp);
        }
Exemple #39
0
 public Explosion(Vector3 position, byte index)
 {
     Position = position;
     Index = index;
     ExplosionType = ExplosionType.Big;
 }
public bool Equals(ExplosionType obj) 
{
    if (obj == null) return false;
    return (obj.swigCPtr.Handle == this.swigCPtr.Handle);
}
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ExplosionType obj) {
   return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
 }
Exemple #42
0
 public static ExplosionType getExplosionType(string name) {
   ExplosionType ret = new ExplosionType(bwapiPINVOKE.getExplosionType(name), true);
   if (bwapiPINVOKE.SWIGPendingException.Pending) throw bwapiPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }