예제 #1
0
    public void StartBehave()
    {
        float   x = UnityEngine.Random.Range(-6f, 2f);
        Vector3 RandomPosition = new Vector3(x, 0.2f, 0);

        instance         = KOFItem.InstantiateByPool(trap, RandomPosition, GameController.instance.transform, gameObject.layer);
        instance.speller = hero;
    }
예제 #2
0
 protected override void OnEnable()
 {
     t = 0;
     fireTrapInstance = null;
     isTriggerEnter   = false;
     if (livingTime > 0)
     {
         StartCoroutine(Live());
     }
 }
예제 #3
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        CharacterMovement sp = collision.GetComponent <CharacterMovement>();

        if (sp != null)
        {
            //Player activates this trap, shoot sparkes than fire
            Spark.Ativated();
            FireTrap.Ativated();
        }
    }
예제 #4
0
 private void Update()
 {
     t += Time.deltaTime;
     if (t >= 1.7f)
     {
         if (!isTriggerEnter && fireTrapInstance == null)
         {
             Vector3 pos = transform.position;
             pos.y            = 0.05f;
             fireTrapInstance = InstantiateByPool(fireTrap, pos, Quaternion.Euler(0, 0, 0), GameController.instance.transform, gameObject.layer, true);
         }
         //this.enabled = false;
     }
 }
예제 #5
0
    void StopEmission(GameObject particle)
    {
        var systems = particle.GetComponentsInChildren <ParticleSystem>();

        FireExplosion.transform.SetParent(GameController.instance.transform);
        FireBall.transform.SetParent(GameController.instance.transform);
        foreach (ParticleSystem system in systems)
        {
            ParticleSystem.CollisionModule cm = system.collision;
            cm.enabled = true;
            system.Stop();
        }
        if (!IsTrap)
        {
            StartCoroutine(DestroyParticle());
            Vector3 p = transform.localPosition;
            p = new Vector3(p.x, 0.1f, p.z);
            FireTrap go = InstantiateByPool(fireTrap, p, GameController.instance.transform, gameObject.layer);
            go.speller = speller;
            IsTrap     = true;
        }
    }
예제 #6
0
    private void OnTriggerStay2D(Collider2D collision)
    {
        FireTrap flames = collision.GetComponent <FireTrap>();

        if (flames != null)
        {
            bool temp = flames.canDama;
            if (temp == true)
            {
                flameCount++;
                if (flameCount >= 100)
                {
                    damagePlayer();
                    flameCount = 0;
                }
            }
        }
        else
        {
            flameDama = false;
        }
    }
예제 #7
0
        public virtual void MobPress(Mob mob)
        {
            int cell = mob.pos;

            if (pit[cell] && !mob.Flying)
            {
                Chasm.MobFall(mob);
                return;
            }

            bool trap = true;

            switch (map[cell])
            {
            case Terrain.TOXIC_TRAP:
                ToxicTrap.Trigger(cell, mob);
                break;

            case Terrain.FIRE_TRAP:
                FireTrap.Trigger(cell, mob);
                break;

            case Terrain.PARALYTIC_TRAP:
                ParalyticTrap.Trigger(cell, mob);
                break;

            case Terrain.POISON_TRAP:
                PoisonTrap.Trigger(cell, mob);
                break;

            case Terrain.ALARM_TRAP:
                AlarmTrap.Trigger(cell, mob);
                break;

            case Terrain.LIGHTNING_TRAP:
                LightningTrap.Trigger(cell, mob);
                break;

            case Terrain.GRIPPING_TRAP:
                GrippingTrap.Trigger(cell, mob);
                break;

            case Terrain.SUMMONING_TRAP:
                SummoningTrap.Trigger(cell, mob);
                break;

            case Terrain.DOOR:
                Door.Enter(cell);

                goto default;

            default:
                trap = false;
                break;
            }

            if (trap)
            {
                if (Dungeon.Visible[cell])
                {
                    Sample.Instance.Play(Assets.SND_TRAP);
                }

                Set(cell, Terrain.INACTIVE_TRAP);
                GameScene.UpdateMap(cell);
            }

            var plant = plants[cell];

            if (plant != null)
            {
                plant.Activate(mob);
            }
        }
예제 #8
0
        public virtual void Press(int cell, actors.Character ch)
        {
            if (pit[cell] && ch == Dungeon.Hero)
            {
                Chasm.HeroFall(cell);
                return;
            }

            var trap = false;

            switch (map[cell])
            {
            case Terrain.SECRET_TOXIC_TRAP:
                GLog.Information(TXT_HIDDEN_PLATE_CLICKS);
                goto case Terrain.TOXIC_TRAP;

            case Terrain.TOXIC_TRAP:
                trap = true;
                ToxicTrap.Trigger(cell, ch);
                break;

            case Terrain.SECRET_FIRE_TRAP:
                GLog.Information(TXT_HIDDEN_PLATE_CLICKS);
                goto case Terrain.FIRE_TRAP;

            case Terrain.FIRE_TRAP:
                trap = true;
                FireTrap.Trigger(cell, ch);
                break;

            case Terrain.SECRET_PARALYTIC_TRAP:
                GLog.Information(TXT_HIDDEN_PLATE_CLICKS);
                goto case Terrain.PARALYTIC_TRAP;

            case Terrain.PARALYTIC_TRAP:
                trap = true;
                ParalyticTrap.Trigger(cell, ch);
                break;

            case Terrain.SECRET_POISON_TRAP:
                GLog.Information(TXT_HIDDEN_PLATE_CLICKS);
                goto case Terrain.POISON_TRAP;

            case Terrain.POISON_TRAP:
                trap = true;
                PoisonTrap.Trigger(cell, ch);
                break;

            case Terrain.SECRET_ALARM_TRAP:
                GLog.Information(TXT_HIDDEN_PLATE_CLICKS);
                goto case Terrain.ALARM_TRAP;

            case Terrain.ALARM_TRAP:
                trap = true;
                AlarmTrap.Trigger(cell, ch);
                break;

            case Terrain.SECRET_LIGHTNING_TRAP:
                GLog.Information(TXT_HIDDEN_PLATE_CLICKS);
                goto case Terrain.LIGHTNING_TRAP;

            case Terrain.LIGHTNING_TRAP:
                trap = true;
                LightningTrap.Trigger(cell, ch);
                break;

            case Terrain.SECRET_GRIPPING_TRAP:
                GLog.Information(TXT_HIDDEN_PLATE_CLICKS);
                goto case Terrain.GRIPPING_TRAP;

            case Terrain.GRIPPING_TRAP:
                trap = true;
                GrippingTrap.Trigger(cell, ch);
                break;

            case Terrain.SECRET_SUMMONING_TRAP:
                GLog.Information(TXT_HIDDEN_PLATE_CLICKS);
                goto case Terrain.SUMMONING_TRAP;

            case Terrain.SUMMONING_TRAP:
                trap = true;
                SummoningTrap.Trigger(cell, ch);
                break;

            case Terrain.HIGH_GRASS:
                HighGrass.Trample(this, cell, ch);
                break;

            case Terrain.WELL:
                WellWater.AffectCell(cell);
                break;

            case Terrain.ALCHEMY:
                if (ch == null)
                {
                    Alchemy.Transmute(cell);
                }
                break;

            case Terrain.DOOR:
                Door.Enter(cell);
                break;
            }

            if (trap)
            {
                Sample.Instance.Play(Assets.SND_TRAP);

                if (ch == Dungeon.Hero)
                {
                    Dungeon.Hero.Interrupt();
                }

                Set(cell, Terrain.INACTIVE_TRAP);
                GameScene.UpdateMap(cell);
            }

            var plant = plants[cell];

            if (plant != null)
            {
                plant.Activate(ch);
            }
        }