Exemplo n.º 1
0
        public static DrawingGroup CreateIceShard(IceShard s)
        {
            DrawingGroup g = null;

            s.SceneMgr.Invoke(new Action(() =>
            {
                BitmapImage bi = new BitmapImage();
                bi.BeginInit();
                bi.UriSource         = new Uri("pack://application:,,,/resources/images/ice-shards/broken_ice_" + s.TextureId + ".png");
                bi.DecodePixelWidth  = (int)s.Size.Width * 2;
                bi.DecodePixelHeight = (int)s.Size.Height * 2;
                bi.EndInit();

                g = new DrawingGroup();
                ImageDrawing img  = new ImageDrawing();
                img.ImageSource   = bi;
                img.Rect          = new Rect(s.Size);
                TransformGroup tg = new TransformGroup();
                tg.Children.Add(new TranslateTransform(s.Position.X, s.Position.Y));
                g.Transform = tg;
                g.Children.Add(img);
            }));

            return(g);
        }
Exemplo n.º 2
0
    public void SelectClickSpell(int s)
    {
        clean();
        switch (s)
        {
        case 0:
            spellText = GameObject.Instantiate(Resources.Load("SpellTexts/FireballText")) as GameObject;
            Destroy(escolhida [0].icon);
            escolhida[0] = new Fireball();
            spellbook.UpdateSpellIcons();
            break;

        case 1:
            spellText = GameObject.Instantiate(Resources.Load("SpellTexts/IceShardText")) as GameObject;
            if (liberada [0] == 1)
            {
                Destroy(escolhida [0].icon);
                escolhida [0] = new IceShard();
                spellbook.UpdateSpellIcons();
            }
            else
            {
                buttonLiberar = GameObject.Instantiate(Resources.Load("ButC")) as GameObject;
                buttonLiberar.GetComponent <CompItem>().setSpSelec(0);
            }
            break;
        }
    }
Exemplo n.º 3
0
    public void dropIcicle()
    {
        IceShard s = GameObject.Instantiate(IceShardPrefab, Vector3.Lerp(IceShardSpawnPoint1.position, IceShardSpawnPoint2.position, Random.value), IceShardPrefab.transform.rotation);

        s.Falling            = true;
        s.Autosensing        = false;
        s.FallTime           = Time.time;
        LastShardDroppedTime = Time.time;
    }
Exemplo n.º 4
0
        public static IceShard CreateIceShard(SceneMgr mgr, Vector position, Size size, int texture)
        {
            IceShard s = new IceShard(mgr, IdMgr.GetNewId(mgr.GetCurrentPlayer().GetId()));

            s.Size      = size;
            s.Position  = position;
            s.TextureId = texture;
            s.SetGeometry(SceneGeometryFactory.CreateIceShard(s));

            return(s);
        }
Exemplo n.º 5
0
    public void reform()
    {
        IceShard reformedshard = GameObject.Instantiate(this.gameObject).GetComponent <IceShard>();

        reformedshard.reformvalue = 0f;
        reformedshard.Reforming   = true;
        reformedshard.Falling     = false;
        reformedshard.Live        = true;
        reformedshard.wobblescale = reformedshard.WobbleTransform.localScale;
        reformedshard.WobbleTransform.localScale = new Vector3(0f, 0f, 0f);
    }
        private void CreateShard(Vector dir, int text, double rotation, double angle)
        {
            IceShard s = SceneObjectFactory.CreateIceShard(me.SceneMgr, me.Position, new System.Windows.Size(20, 20), text + 1);

            s.Direction = dir.Rotate(angle * (Math.PI / 4));

            LinearRotationControl rc = new LinearRotationControl();

            rc.RotationSpeed = (float)(Math.PI / 8 * rotation);
            s.AddControl(rc);

            LinearMovementControl mc = new LinearMovementControl();

            mc.Speed = 20;
            s.AddControl(mc);

            s.AddControl(new LimitedLifeControl(4));

            me.SceneMgr.DelayedAttachToScene(s);
        }
Exemplo n.º 7
0
    public Miniboss AddMinibossEntity(MinibossData data)
    {
        MinibossPrototype proto = MinibossDatabase.GetMinibossPrototype(data.type);
        Miniboss          temp  = null;

        switch (proto.minibossType)
        {
        case MinibossType.BogBeast:
            temp = new BogBeast(proto);
            temp.Spawn(GetMapTilePosition(data.TilePosition));
            break;

        case MinibossType.Salamander:
            temp = new Salamander(proto);
            temp.Spawn(GetMapTilePosition(data.TilePosition));
            break;

        case MinibossType.IceShard:
            temp = new IceShard(proto);
            temp.Spawn(GetMapTilePosition(data.TilePosition));
            break;

        case MinibossType.Shroombo:
            temp = new Shroombo(proto);
            temp.Spawn(GetMapTilePosition(data.TilePosition));
            break;

        case MinibossType.GiantCrab:
            temp = new GiantCrab(proto);
            temp.Spawn(GetMapTilePosition(data.TilePosition));
            break;

        case MinibossType.Voidbeast:
            temp = new Voidbeast(proto);
            temp.Spawn(GetMapTilePosition(data.TilePosition));
            break;
        }

        return(temp);
    }
Exemplo n.º 8
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);
            }
        }
    }