Esempio n. 1
0
    public void explode()
    {
        if (hasExploded)
        {
            return;
        }
        hasExploded = true;
        Am.am.oneshot(Am.am.M.GrenadeExplosion);
        ExplosionPosition = this.transform.position;
        GrenadeExplosion.Play(true);
        Astronaut.TheAstronaut.addCamShake(1f * (1f / (1f + ((Astronaut.TheAstronaut.transform.position - ExplosionPosition).magnitude / 8f))), .5f, 1f, .5f, 1f);
        MyRigidbody.bodyType = RigidbodyType2D.Kinematic;

        Collider2D[] cols = Physics2D.OverlapCircleAll(this.transform.position, BLASTRADIUS, LayerMask.GetMask(new string[] { "Enemy", "Boss" }));

        foreach (Collider2D col in cols)
        {
            GenericEnemy ge = col.gameObject.GetComponent <GenericEnemy>();
            if (ge != null)
            {
                OnGrenadeHit(col);
                continue;
            }
            BossGolem bo = col.gameObject.GetComponent <BossGolem>();

            if (bo != null)
            {
                OnGrenadeHit(col);
                continue;
            }
        }
        Live = false;
        Remove();
    }
Esempio n. 2
0
 private void Start()
 {
     if (!f_respawn)
     {
         m_enemy = Instantiate(preObject, transform).GetComponent <GenericEnemy>();
     }
 }
 private void Awake()
 {
     enemyBase = GetComponentInParent <GenericEnemy>();
     enemyBase.enemyAIUpdate += RushEnemyUpdate;
     moveForce += Random.Range(-0.5f, 1f);
     maxVel    += Random.Range(0.5f, 0.5f);
 }
Esempio n. 4
0
    private void OnTriggerEnter2D(Collider2D col)
    {
        //collision with a projectile
        //collision with an enemy
        //IceSkullProjectile
        //Enemy_Projectile p
        if (!Launched)
        {
            EnemyProjectile proj = col.gameObject.GetComponent <EnemyProjectile>();
            if ((proj != null) && (proj.enabled) && (proj.Live) && (CanFreezeProjectiles))
            {
                freezeProjectile(proj);
                GameObject.Destroy(proj.gameObject, 10f);

                return;
            }
        }

        GenericEnemy en = col.gameObject.GetComponent <GenericEnemy>();

        if ((en != null) && (en.Alive) && (!col.isTrigger))
        {
            if (!Launched)
            {
                if (BlizzardField)
                {
                    en.freeze(1.2f);
                    FreezePoof.Play();
                }
            }


            return;
        }
    }
Esempio n. 5
0
        public void Test_Fails_Impossible_Fight_Barely()
        {
            var cards  = gsl("Bash", "Inflame", "Strike");
            var enemy  = new GenericEnemy(100, 100, 33, 33);
            var player = new Player(potions: new List <Potion>()
            {
                new StrengthPotion(), new StrengthPotion()
            },
                                    relics: new List <Relic>()
            {
                new FusionHammer()
            });
            var deck = new Deck(cards, gsl(), gsl(), gsl());
            var fs   = new MonteCarlo(deck, enemy, player, firstHand: cards);
            var node = fs.SimAfterFirstDraw();

            Assert.AreEqual(0, node.Randoms.Count);
            Assert.AreEqual(1, node.Choices.Count);
            //also assert there is only one good path.
            var best = node.Choices.Max(el => el.GetValue());

            //var bb = GetBestLeaf(node.Randoms);
            //var hh = bb.AALeafHistory();
            Assert.AreEqual(-1, best.Value);
            Assert.AreEqual(-1, node.GetValue().Value);
        }
Esempio n. 6
0
        public void Test_Longer_Setup()
        {
            //Correct strategy is to take damage the first round.
            var cis = GetCis("Defend", "Strike", "Defend", "Inflame", /* AFTER */ "Inflame", "Inflame", "Inflame", "Defend");

            var enemyStatuses = GSS(new Feather(), 10);

            enemyStatuses.AddRange(GSS(new Strength(), -10));
            var enemy     = new GenericEnemy(amount: 1, count: 5, hp: 14, hpMax: 14, statuses: enemyStatuses);
            var player    = new Player(drawAmount: 4, hp: 10);
            var firstHand = new List <string>()
            {
                "Inflame", "Inflame", "Inflame", "Defend"
            };
            var deck = new Deck(cis);

            var fs   = new MonteCarlo(deck, enemy, player, firstHand: firstHand);
            var node = fs.SimAfterFirstDraw();

            Assert.AreEqual(1, node.Choices.Count);
            //also assert there is only one good path.
            var best = node.Choices.Max(el => el.GetValue());

            var bests = node.Choices.Where(el => el.GetValue().Value == 5);
            //this is good but there can still be dumb paths that are longer.

            var win     = bests.First();
            var hh      = win.GetTurnHistory();
            var winNode = GetBestLeaf(node);

            Assert.AreEqual(5, hh.Count());

            Assert.AreEqual(5, best.Value);
            Assert.AreEqual(5, node.GetValue().Value);
        }
Esempio n. 7
0
 public void Setup(GenericEnemy controls)
 {
     this.ai         = controls;
     this.pathSeeker = controls.GetComponent <Seeker>();
     this.transform  = controls.transform;
     this.body       = controls.GetComponent <Rigidbody2D>();
 }
    void Update()
    {
        if (!this.foundAllBaseComponents)
        {
            agent = GetComponent <NavMeshAgent>();
            setBaseComponents();
        }



        GenericEnemy enemy = (GenericEnemy)(genericAI);

        switch (Mode)
        {
        case AIMode.Moving:
            UpdateMove();
            break;

        case AIMode.Attacking:
            UpdateAttack();
            break;

        case AIMode.Idling:
            UpdateIdle();
            break;

        case AIMode.Wandering:
            UpdateWander(enemy.wanderRange);
            break;

        default:
            //idling
            break;
        }
    }
Esempio n. 9
0
 private void Spawn()
 {
     _spawned = Instantiate(_toSpawn,
                            transform.position + _spawnOffsetVec3,
                            Quaternion.identity);
     _spawned.OnDeathEvent += SpawnedDied;
     _beatsSinceLastSpawn   = 0;
 }
Esempio n. 10
0
 private void SpawnedDied()
 {
     _spawned = null;
     if (_waitTillDeath)
     {
         _beatsSinceLastSpawn = 0;
     }
 }
Esempio n. 11
0
    private void OnEnemyCreated(BoidController obj)
    {
        GenericEnemy enemy = obj.GetComponent <GenericEnemy>();

        if (enemy != null)
        {
            enemy.notifyOnDestroyed += OnEnemyKilled;
        }
    }
Esempio n. 12
0
    private void OnEnemyKilled(GenericEnemy enemy)
    {
        currentScore            += enemy.killPoints;
        enemy.notifyOnDestroyed -= OnEnemyKilled;

        if (overlay != null)
        {
            overlay.points = currentScore;
        }
    }
Esempio n. 13
0
        public void Test_Using_Inflame()
        {
            var cards = gsl("Strike", "Defend", "Inflame", "Defend", "Defend");

            var enemy  = new GenericEnemy(4, 4, 8, 8);
            var player = new Player(hp: 1);
            var deck   = new Deck(cards, gsl(), gsl(), gsl());
            var fs     = new MonteCarlo(deck, enemy, player, firstHand: cards);
            var node   = fs.SimAfterFirstDraw();

            Assert.AreEqual(1, node.GetValue().Value);
        }
Esempio n. 14
0
    void Start()
    {
        TravelDistance      = 0f;
        startPosition       = this.transform.position;
        VinePosition        = this.transform.position;
        VineAttachedToSolid = null;
        VineAttachedToEnemy = null;
        VineAttachedToGolem = null;
        VineGrapplingSound  = AudioManager.AM.createGeneralAudioSource(AudioManager.AM.JungleElementPower, AudioManager.AM.PlayerAudioMixer, .8f, 1f, true);

        LeechLoop = AudioManager.AM.createGeneralAudioSource(AudioManager.AM.LeechLoop, AudioManager.AM.PlayerAudioMixer, 0f, 1f, true);
        LeechLoop.Play();
    }
 private void Awake()
 {
     enemyBase = GetComponentInParent <GenericEnemy>();
     enemyBase.enemyAIUpdate += LaserEnemyUpdate;
     laserLineRen             = GetComponent <LineRenderer>();
     psys            = GetComponent <ParticleSystem>();
     range          += Random.Range(-1f, 1f);
     damage         += Random.Range(-5, 5);
     chargeTime     += Random.Range(-0.15f, 0.15f);
     cooldown       += Random.Range(-2f, 1.5f);
     moveForce      += Random.Range(-0.5f, 0.5f);
     maxVel         += Random.Range(-0.5f, 0.5f);
     knockbackForce += Random.Range(-10f, 10f);
 }
Esempio n. 16
0
        public void Test_PommelStrike_Randomness()
        {
            var cards = gsl("Defend", "Strike", "Inflame", "PommelStrike+");

            var enemy  = new GenericEnemy(15, 3, 20, 20);
            var player = new Player(drawAmount: 1);
            var deck   = new Deck(cards, gsl(), gsl(), gsl());
            var fs     = new MonteCarlo(deck, enemy, player, firstHand: gsl("PommelStrike+"));
            var node   = fs.SimAfterFirstDraw();

            Assert.AreEqual(1, node.Choices.Count);
            var ps = node.Choices.First().Choices.Single(el => el.FightAction.CardInstance?.Card.Name == nameof(PommelStrike));

            Assert.AreEqual(0, ps.Randoms.Count()); //we only draw the one reality that the deck was shuffled into.
        }
Esempio n. 17
0
        public void Test_Defending()
        {
            //It is now a requirement that all fights end before maxTurns
            //since we can't calculate value for incomplete fights.
            var cards = gsl("Defend", "Defend", "Strike");

            var enemy  = new GenericEnemy(amount: 5, count: 1, hp: 8, statuses: GSS(new Feather(), 5));
            var player = new Player(hp: 5); //fullblock first turn. 2nd turn take 5
            var deck   = new Deck(cards, gsl(), gsl(), gsl());
            var fs     = new MonteCarlo(deck, enemy, player, firstHand: cards);
            var node   = fs.SimAfterFirstDraw();
            var best   = GetBestLeaf(node);

            Assert.AreEqual(5, node.GetValue().Value);
        }
Esempio n. 18
0
    public void OnVolcanoEruptionTriggered(Collider2D col)
    {
        if (!(Erupting || AlwaysErupting))
        {
            return;
        }
        if (Frozen)
        {
            return;
        }
        Astronaut a   = col.gameObject.GetComponent <Astronaut>();
        float     dps = (200f * Time.fixedDeltaTime);

        if ((a != null))
        {
            if (!Frozen)
            {
                if ((Time.time - a.ReviveTime) >= 2f)
                {
                    if (a.Alive)
                    {
                        Vector3 dif = (a.transform.position - this.transform.position);

                        Vector3 cross = Vector3.Cross(this.transform.up, Vector3.forward);
                        Am.am.oneshot(Am.am.M.LavaBurn);
                        if (a.TakeDamage(dps, cross * 0f * 5f * Mathf.Sign(Vector3.Dot(cross, dif))))
                        {
                        }
                    }
                    else
                    {
                        //BurnParticles
                    }
                }
            }
        }
        else
        {
            GenericEnemy ge = col.gameObject.GetComponent <GenericEnemy>();
            if ((ge != null) && (ge.Alive))
            {
                //Am.am.oneshot(Am.am.M.LavaBurn);
                //ge.Kill();
                ge.TakeDamage(dps, new Vector2());
                Am.am.oneshot(Am.am.M.LavaBurn);
            }
        }
    }
Esempio n. 19
0
        public void Test_Fractions()
        {
            //You have a 1/3 chance of living
            var cards = gsl("Strike", "Defend", "Inflame");

            var enemy  = new GenericEnemy(100, 100, 1, 1);
            var player = new Player(drawAmount: 1);
            var deck   = new Deck(cards, gsl(), gsl(), gsl());
            var fs     = new MonteCarlo(deck, enemy, player);
            var node   = fs.SimIncludingDraw();

            Assert.AreEqual(3, node.Choices.Count);
            var values = node.Choices.Select(el => el.GetValue().Value).OrderBy(el => el).ToList();

            CollectionAssert.AreEqual(new List <double>()
            {
                100, -1, -1
            }.OrderBy(el => el), values);
        }
Esempio n. 20
0
    private void OnCollisionStay2D(Collision2D collision)
    {
        Astronaut a = collision.gameObject.GetComponent <Astronaut>();

        if (HazardActive)
        {
            if ((a != null))
            {
                Vector3 dif = (a.transform.position - this.transform.position);
                BurnParticles.transform.position = collision.contacts[0].point;
                BurnParticles.transform.position = collision.contacts[0].point;
                //BurnParticles.Emit(50);
                float d = 25f;
                if (a.Alive)
                {
                    Am.am.oneshot(Am.am.M.LavaBurn);
                }
                if (a.TakeDamage(d, (a.Health > d) ? new Vector3(Mathf.Abs(a.MyRigidbody.velocity.x) * Mathf.Sign(-(a.transform.position - a.LastGroundedLocation).x), 10f, 0f) : new Vector3(0f, 1f, 0f)))
                {
                    //...
                    //...WHAT HAPPENS IF YOU DIE IN LAVA?
                    //You teleport
                    a.transform.position   = a.LastGroundedLocation;
                    a.MyRigidbody.velocity = new Vector2();
                }
                else
                {
                }
                BurnParticles.transform.position = collision.contacts[0].point;
                BurnParticles.Emit(20 / (prevparticlelowlevel?4:1));
            }
            else
            {
                GenericEnemy ge = collision.gameObject.GetComponent <GenericEnemy>();
                if ((ge != null) && (ge.Alive))
                {
                    Am.am.oneshot(Am.am.M.LavaBurn);
                    ge.Kill();
                }
            }
        }
    }
Esempio n. 21
0
        public void Test_UsingPotionAndInflameDefending()
        {
            var cards = gsl("Defend", "Defend", "Inflame", "Defend", "Strike");

            var enemy  = new GenericEnemy(15, 3, 10, 10);
            var player = new Player(hp: 1, potions: new List <Potion>()
            {
                new StrengthPotion()
            });
            var deck = new Deck(cards, gsl(), gsl(), gsl());
            var fs   = new MonteCarlo(deck, enemy, player, firstHand: cards);
            var node = fs.SimAfterFirstDraw();

            Assert.AreEqual(1, node.GetValue().Value);
            //assert the right cards were played.
            var drawNode = node.Choices.First();
            var wins     = drawNode.Choices.Where(el => el.Value.Value == 1);

            Assert.AreEqual(3, wins.Count());
            //block, pot, inflame
        }
Esempio n. 22
0
        public void Test_SelfControl_SavingPummelAndDefending()
        {
            var draw = gsl("Pummel", "Inflame", "Inflame", /* first round cards: */ "Defend", "Defend", "Inflame", "Inflame", "Inflame");
            // correct strat: take 5 first round, playing all inflames then pummel.
            var enemyStatuses = GSS(new Feather(), 10);

            enemyStatuses.AddRange(GSS(new Strength(), -10));
            var enemy = new GenericEnemy(amount: 1, count: 5, hp: 48, statuses: enemyStatuses);
            //after 2nd round enemy will kill player.
            var player    = new Player(hp: 10);
            var deck      = new Deck(draw, gsl(), gsl(), gsl());
            var firstHand = gsl("Defend", "Defend", "Inflame", "Inflame", "Inflame");
            var fs        = new MonteCarlo(deck, enemy, player, firstHand: firstHand);
            var node      = fs.SimAfterFirstDraw();

            Assert.AreEqual(1, node.Choices.Count);
            //also assert there is only one good path.
            var best = node.Choices.Max(el => el.GetValue());

            //var bests = node.Randoms.Where(el => el.GetValue().Value == 5);
            //this is good but there can still be dumb paths that are longer.

            //var bf = bests.First();
            //var wn = GetBestLeaf(bf);
            //var hh = wn.AALeafHistory();

            Assert.AreEqual(5, best.Value);
            Assert.AreEqual(5, node.GetValue().Value);
            //node.Display(Output, true);
            //Assert.IsFalse(true);

            var winNode = GetBestLeaf(node);
            var d       = winNode.Depth;
            var h       = winNode.GetTurnHistory();
            var hh      = winNode.AALeafHistory();

            Assert.AreEqual(5, h.Count()); //draw d endturn monsterend start i p

            //this makes sure it doesn't spuriously play a defend first in the last turn.
        }
Esempio n. 23
0
        public void Test_PommelStrike_Random_Simple()
        {
            //reshuffle has only one option due to all identical
            var cards   = gsl("PommelStrike+");
            var discard = gsl("Defend", "Defend", "Defend");

            var enemy  = new GenericEnemy(15, 3, 20, 20);
            var player = new Player(drawAmount: 1);
            var deck   = new Deck(cards, gsl(), discard, gsl());
            var fs     = new MonteCarlo(deck, enemy, player, firstHand: gsl("PommelStrike+"));
            var node   = fs.SimAfterFirstDraw(5000);

            Assert.AreEqual(1, node.Choices.Count);
            Assert.AreEqual(2, node.Choices.First().Choices.Count);
            var qq  = node.Choices.First();
            var psa = qq.Choices.Where(el => el.FightAction.CardInstance?.Card.Name == nameof(PommelStrike));

            Assert.AreEqual(1, psa.Count());
            var ps = psa.First();

            Assert.AreEqual(1, ps.Randoms.Count());
        }
Esempio n. 24
0
        public void Test_Finds_Single_Line()
        {
            var cards  = gsl("Bash", "Strike");
            var enemy  = new GenericEnemy(100, 100, 32, 32);
            var player = new Player(potions: new List <Potion>()
            {
                new StrengthPotion(), new StrengthPotion(), new StrengthPotion()
            }, relics: new List <Relic>()
            {
                new FusionHammer()
            });
            var deck = new Deck(cards, gsl(), gsl(), gsl());
            var fs   = new MonteCarlo(deck, enemy, player, firstHand: cards);
            var node = fs.SimAfterFirstDraw();

            Assert.AreEqual(1, node.Choices.Count);
            //also assert there is only one good path.
            var wins = node.Choices.First().Choices.Where(el => el.GetValue().Value == 100);
            var win  = wins.First();
            var hh   = win.GetTurnHistory();

            Assert.AreEqual(1, wins.ToList().Count());

            //draw, sss, bash+strike to just kill
            Assert.AreEqual(5, hh.Count());
            Assert.AreEqual(100, node.GetValue().Value);

            var expectedActions = new List <FightAction>()
            {
                new FightAction(FightActionEnum.Potion, potion: new StrengthPotion(), target: enemy),
                new FightAction(FightActionEnum.Potion, potion: new StrengthPotion(), target: enemy),
                new FightAction(FightActionEnum.Potion, potion: new StrengthPotion(), target: enemy),
                new FightAction(FightActionEnum.PlayCard, card: GetCi("Bash")),
                new FightAction(FightActionEnum.PlayCard, card: GetCi("Strike")),
            };

            Assert.IsTrue(TestActionSeries(win, expectedActions, out var msg), msg);
        }
Esempio n. 25
0
    public void Spawn()
    {
        _cooldownTimer = this.SpawnCooldown;

        int       enemyId = this.SpawnPool != null && this.SpawnPool.Length > 0 ? this.SpawnPool[Random.Range(0, this.SpawnPool.Length)] : StaticData.EnemyData.EnemyTypeArray[Random.Range(0, StaticData.EnemyData.EnemyTypeArray.Length)].Id;
        EnemyType enemy   = StaticData.EnemyData.EnemyTypes[enemyId];

        GameObject prefab = this.GenericPrefab;

        if (enemy.PrefabName == "generic_motion")
        {
            prefab = this.GenericMotionPrefab;
        }
        else if (enemy.PrefabName == "move_and_fire")
        {
            prefab = this.MoveAndFirePrefab;
        }

        GameObject   enemyObject    = Instantiate(prefab, _spawnPosition.HasValue ?_spawnPosition.Value : (Vector2)this.transform.position, Quaternion.identity) as GameObject;
        GenericEnemy enemyComponent = enemyObject.GetComponent <GenericEnemy>();

        enemyComponent.EnemyType = enemy;
        enemyComponent.Targets   = new List <Transform>(this.Targets);
        enemyComponent.NoFire    = this.NoFire;
        _spawnPosition           = null;

        if (this.SpawnCallback != null)
        {
            this.SpawnCallback(enemyObject);
        }

        _spawning = false;
        if (this.DestroyAfterSpawn)
        {
            Destroy(this.gameObject);
        }
    }
Esempio n. 26
0
        public void Test_PommelStrike_Randomness_Reshuffle()
        {
            var cards   = gsl("Defend", "PommelStrike+");
            var discard = gsl("Defend", "Strike", "Inflame", "Pummel", "Shockwave", "Defend");

            var enemy  = new GenericEnemy(15, 3, 20, 20);
            var player = new Player(drawAmount: 1);
            var deck   = new Deck(cards, gsl(), discard, gsl());
            var fs     = new MonteCarlo(deck, enemy, player, firstHand: gsl("PommelStrike+"));
            var node   = fs.SimAfterFirstDraw(5000);

            Assert.AreEqual(1, node.Choices.Count);
            Assert.AreEqual(2, node.Choices.First().Choices.Count);
            var qq  = node.Choices.First();
            var psa = qq.Choices.Where(el => el.FightAction.CardInstance?.Card.Name == nameof(PommelStrike));

            Assert.AreEqual(1, psa.Count());
            var ps  = psa.First();
            var res = new List <string>();

            foreach (var r in ps.Randoms)
            {
                var draw = r.Fight.GetDrawPile;
                //although there are only a few draws, there are many orderings.
                //draw = D S I P Sh D.  6!
                res.Add(SJ(draw));
                //there should be 360 here.  6!/2! due to duplicate defend
            }
            res.Sort();
            Assert.AreEqual(360, res.Count);

            //structure
            //R=>C1 (ps) => [1 R for each of the possible draws; defend+every other card in discard]
            //note that there are two defends so they should not be doublecounted.

            //Assert.AreEqual(5, ps.Randoms.Count()); //we only draw the one reality that the deck was shuffled into.
        }
Esempio n. 27
0
    private void OnCollisionEnter2D(Collision2D col)
    {
        if (removing)
        {
            return;
        }
        //collision with geometry
        //collision.contacts[0].normal

        GenericEnemy en = col.gameObject.GetComponent <GenericEnemy>();

        if ((en != null) && (en.Alive) && (!col.collider.isTrigger))
        {
            if (CanFreezeEnemies)
            {
                if (Launched)
                {
                    en.freeze(1.2f);
                    FreezePoof.Play();
                    Remove();
                }
                else
                {
                    /*
                     * if (FreezeFieldWhileHeld)
                     * {
                     *  en.freeze(1.2f);
                     *  FreezePoof.Play();
                     * }
                     */
                }
            }


            return;
        }

        EnemyProjectile proj = col.gameObject.GetComponent <EnemyProjectile>();

        if ((proj != null) && (proj.enabled) && (proj.Live) && (CanFreezeProjectiles))
        {
            freezeProjectile(proj);
            Remove();
            return;
        }

        Hazard haz = col.gameObject.GetComponent <Hazard>();

        if ((haz != null) && (haz.enabled) && (!haz.Permafrozen))
        {
            if (CanFreezeHazards)
            {
                freezeHazard(haz);
            }
            Remove();
            return;
        }
        //EnvironmentHazard

        if (col.gameObject.layer == LayerMask.NameToLayer("Geometry"))
        {
            //Hit a wall.
            //Create Ice on this wall
            if (FormsIcePillar)
            {
                Vector2   ndir = col.contacts[0].normal;
                IcePillar p    = GameObject.Instantiate(IcePillarPrefab, col.contacts[0].point, Quaternion.LookRotation(ndir, -Vector3.forward)).GetComponent <IcePillar>();
                //p.transform.Rotate(90f,0f,0f,Space.World);
                p.Lifetime = 5f;
            }


            FreezePoof.Play();
            if (BlizzardField)
            {
                explode();
            }
            Remove();
            return;
        }
    }
Esempio n. 28
0
    public void OnTriggerStay2D(Collider2D collision)
    {
        if (IsFlamePatch)
        {
            FlameBar fb = collision.gameObject.GetComponent <FlameBar>();
            if (fb != null)
            {
                if (fb.IsFlamePatch)
                {
                    if (fb.StartTime > this.StartTime)
                    {
                        Remove();
                        Debug.Log("Flame Patch override");
                    }
                }
                return;
            }
        }
        if (!FlameActive)
        {
            return;
        }
        GenericEnemy ge = collision.GetComponent <GenericEnemy>();

        if (ge != null)
        {
            ge.LastBurnTime = Time.time;

            float inc = ((120f + (400f * Astronaut.FirePowerFactor)) * Time.fixedDeltaTime * (1f / Mathf.Max(ge.Burnability, 0.0001f)));
            if (ge.burn(inc / 200f, .5f * (1f + (3f * Astronaut.FirePowerFactor))))
            {
                ge.BurnDirection = ((int)Mathf.Sign(this.transform.forward.x));
                if (ge.BurnDirection == 0)
                {
                    ge.BurnDirection = 1;
                }
                //SingeSound.PlayOneShot(Am.am.M.LavaBurn, 1f);
            }
            if (!ge.AnchoredToVine)
            {
                Rigidbody2D rb = ge.gameObject.GetComponent <Rigidbody2D>();
                if (rb != null)
                {
                    rb.AddForce(new Vector2(this.transform.forward.x, this.transform.forward.y).normalized * 50f * (Astronaut.FirePowerFactor));
                    //Move the object if necessary.
                }
            }
            if (ge.isIncinerating())
            {
                if (ge is IcePillar)
                {
                    (ge as IcePillar).Remove();
                    Am.am.oneshot(Am.am.M.MeltSound);
                }
                Am.am.oneshot(Am.am.M.LavaBurn, IsFlamePatch?.1f : 1f);
            }
            //ge.TakeDamage(, this.transform.forward*0.001f);

            SingeSound.PlayOneShot(SingeSound.clip, IsFlamePatch ? .1f : 1f);
        }
        MeltableIceWall me = collision.GetComponent <MeltableIceWall>();

        if (me != null)
        {
            if (me.MeltParticles != null)
            {
                me.MeltParticles.Emit(1);
            }

            me.TakeDamage((120f + (400f * Astronaut.FirePowerFactor)) * Time.fixedDeltaTime, this.transform.forward * 0.001f);
            SingeSound.PlayOneShot(SingeSound.clip, .4f);
        }
        BreakableIceWall bw = collision.GetComponent <BreakableIceWall>();

        if (bw != null)
        {
            bw.TakeDamage((80f + (160f * Astronaut.FirePowerFactor)) * Time.fixedDeltaTime, this.transform.forward * 0.001f);
            SingeSound.PlayOneShot(SingeSound.clip, .2f);
        }
        BurnableLog bl = collision.GetComponent <BurnableLog>();

        if (bl != null)
        {
            bl.TakeDamage((80f + (400f * Astronaut.FirePowerFactor)) * Time.fixedDeltaTime, this.transform.forward * 0.001f);
            SingeSound.PlayOneShot(SingeSound.clip, .2f);
        }
        VoidGolem vg = collision.GetComponent <VoidGolem>();

        if ((vg != null) && (vg.VoidElementType == VoidGolem.VoidElement.Ice))
        {
            if (vg.Ice_FreezingSkinActive)
            {
                float dps = ((40f + (400f * Astronaut.FirePowerFactor)) * Time.fixedDeltaTime);
                vg.SkinMeltingParticles.Emit(1);
                if (vg.IceSkinHealth <= dps)
                {
                    vg.IceSkinHealth = 0f;
                    vg.meltSkinOff();
                    Am.am.oneshot(Am.am.M.MeltSound);
                }
                else
                {
                    vg.IceSkinHealth = vg.IceSkinHealth - dps;

                    SingeSound.PlayOneShot(SingeSound.clip, .2f);
                }
            }

            //vg.TakeDamage(, this.transform.forward * 0.001f);
        }


        IceShard ic = collision.GetComponent <IceShard>();

        if (ic != null)
        {
            ic.transform.localScale = (ic.transform.localScale * (.1f + (.85f * (1f - FirePowerLevel))));
            ic.Live    = false;
            ic.Melting = true;
            SingeSound.Play();
            if (ic.transform.localScale.magnitude <= .1f)
            {
                Am.am.oneshot(Am.am.M.MeltSound);
                GameObject.Destroy(ic.gameObject);
            }
        }

        IceBlock ib = collision.GetComponent <IceBlock>();

        if (ib != null)
        {
            ib.Remove();
            SingeSound.Play();
            //
            //SingeSound.Play();
            ib.transform.localScale = (ib.transform.localScale * .5f);
            if (ib.transform.localScale.magnitude <= .1f)
            {
                Am.am.oneshot(Am.am.M.MeltSound);
                ib.Remove();
                //GameObject.Destroy(ib.gameObject);
            }
        }
    }
Esempio n. 29
0
 //Enemies IO
 public void addEnemy(GenericEnemy enemy)
 {
     this.Enemies.Add(enemy);
 }
Esempio n. 30
0
 public void removeEnemy(GenericEnemy enemy)
 {
     this.Enemies.Remove(enemy);
 }