Inheritance: SpriteRoot, ISpriteAnimatable
Exemple #1
0
    public void CreateSprite(SpriteType spriteType, Vector3 pos, Vector3 dir)
    {
        SpriteProp prop = GetProp(spriteType);

        if (prop == null)
        {
            return;
        }

        SpriteBase sprite = null;

        switch (prop.spriteType)
        {
        case SpriteType.BLOOD:
            sprite = SpriteBlood.pool.Get();
            (sprite as SpriteBlood).Init((int)prop.spriteType, prop.lifeTime, prop.materials[Random.Range(0, prop.materials.Length)],
                                         pos, dir);
            break;

        case SpriteType.BLOOD_BIG:
            sprite = SpriteBloodBig.pool.Get();
            (sprite as SpriteBloodBig).Init((int)prop.spriteType, prop.lifeTime, prop.materials[Random.Range(0, prop.materials.Length)],
                                            pos, dir, prop.scaleVal, prop.scaleTime);
            break;

        default:
            break;
        }

        if (sprite != null)
        {
            _spriteMgr.Add(sprite);
        }
    }
 /// <summary>
 /// Initializes a new instance of the <see cref="DebugSprite"/> class.
 /// </summary>
 /// <param name="world">The <see cref="World" /> in which the instance lives.</param>
 /// <param name="targetSprite">The sprite that we're drawing debug information for.</param>
 public DebugSprite(World world, SpriteBase targetSprite)
     : base(world)
 {
     this.targetSprite         = targetSprite;
     this.lineWidth            = this.World.GetWorldFromPixel(1.0f); // Default to 1 pixel in width
     this.optionMapFlagsShader = new OptionsMapFlagsShader();
 }
Exemple #3
0
 public void OnDeselection(SpriteBase sprite)
 {
     if (sprite is ItemBase)
     {
         ReturnItem(sprite as ItemBase);
     }
 }
Exemple #4
0
    public virtual void Setup(BaseCreature creatureData)
    {
        data           = creatureData;
        data.currentHp = data.hp;
        rb             = GetComponent <Rigidbody2D>();
        rb.angularDrag = data.angularDrag;
        rb.drag        = data.drag;
        rb.mass        = data.mass;
        var coll = GetComponent <Collider2D>();
        var mat  = new PhysicsMaterial2D();

        mat.bounciness       = data.bounciness;
        mat.friction         = data.friction;
        coll.sharedMaterial  = mat;
        transform.localScale = Vector3.one * creatureData.scale;
        view.sprite          = SpriteBase.GetSprite(data.view + data.teamId);
        teamId = data.teamId;
        progressBar.gameObject.SetActive(true);
        if (data.Action != null)
        {
            actionReceiver = gameObject.AddComponent(data.Action.GetType()) as IActionReceiver;
            actionReceiver.Setup(data.Action as IActionReceiver);
        }

        if (data.HitAction != null)
        {
            hitActionReceiver = gameObject.AddComponent(data.HitAction.GetType()) as IActionReceiver;
            hitActionReceiver.Setup(data.HitAction as IActionReceiver);
        }

        MatchManager.OnEndTurn += OnEndTurn;
    }
        private async void Button_Click_1(object sender, RoutedEventArgs e)
        {
            Color accentColor = ((Color)App.Current.Resources["SystemColorControlAccentColor"]);

            TestTransformedSprite = new TransformedSprite()
            {
                AppliedSprite = new Sprite()
                {
                    ImageUri = new Uri("ms-appx:///Assets/Icons/BusArrow.png")
                }, RelativeTransformOrigin = new Point(0.5, 0.473)
            };
            TestSprite = new TransformedSprite()
            {
                AppliedSprite = new CompositeSprite(new Sprite()
                {
                    ImageUri = new Uri("ms-appx:///Assets/Icons/BusBase.png")
                }, TestTransformedSprite), Transform = new ScaleTransform() /*ScaleX = .234375 * 1 / 3, ScaleY = .234375 * 1 / 3*/ }
                {
            };
            //TestSprite = new CompositeSprite(new Sprite() { ImageUri = new Uri("ms-appx:///Assets/Icons/BusBase.png") }, TestTransformedSprite);
            await TestSprite.Load();

            TestSprite.Unlock();
            SetImageRotation();
        }
    // Removes the specified sprite from the animation list,
    // thereby not receiving animation updates.
    // s: A reference to the sprite to be removed.
    public static void Remove(SpriteBase s)
    {
        if (head == s)
        {
            head = (SpriteBase)s.next;

            // See if we need to stop the pump:
            if (head == null)
            {
                StopAnimationPump();
            }
        }
        else
        {
            if (s.next != null)
            {                   // Connect either side:
                s.prev.next = s.next;
                s.next.prev = s.prev;
            }
            else if (s.prev != null)
            {
                // Removing the last item:
                s.prev.next = null;
            }
        }
        s.next = null;
        s.prev = null;
    }
        private void btnExtract_Click(object sender, EventArgs e)
        {
            string folder;
            FolderBrowserDialog o = new FolderBrowserDialog();

            o.Description         = "Select the folder where you want\nto extract all the images.";
            o.ShowNewFolderButton = true;
            if (o.ShowDialog() != System.Windows.Forms.DialogResult.OK)
            {
                return;
            }
            folder = o.SelectedPath + Path.DirectorySeparatorChar;

            SpriteBase sprite = pluginHost.Get_Sprite();

            this.Cursor = Cursors.WaitCursor;
            for (int i = 0; i < infos.Length; i++)
            {
                int      offset = (int)infos[i].offset;
                int      size   = (int)infos[i].size;
                TileForm form   = (images.EndsWith("Tex.dat") ? TileForm.Lineal : TileForm.Horizontal);

                RawImage image = new RawImage(images, -1, form, ColorFormat.colors256, false,
                                              offset + 0x220, size - 0x220);

                RawPalette palette = new RawPalette(images, -1, false,
                                                    offset + 0x20, 0x200);

                sprite.Get_Image(image, palette, 0, 512, 256, false, false, false, true, true).Save(folder + "Image" + i.ToString() + ".png");
            }
            this.Cursor = Cursors.Default;
        }
Exemple #8
0
 public void AddSpriteToGrid(SpriteBase sprite)
 {
     foreach (Point p in sprite.GridPositions)
     {
         MapGridData[p.X, p.Y].Sprites.Add(sprite);
     }
 }
Exemple #9
0
 public void AddSpriteDeltaToGrid(SpriteBase sprite, List <Point> toBeAdded)
 {
     foreach (Point p in toBeAdded)
     {
         MapGridData[p.X, p.Y].Sprites.Add(sprite);
     }
 }
Exemple #10
0
 public void RemoveSpriteFromGrid(SpriteBase sprite, List <Point> toBeRemoved)
 {
     foreach (Point p in toBeRemoved)
     {
         MapGridData[p.X, p.Y].Sprites.Remove(sprite);
     }
 }
Exemple #11
0
        public bool isInsideGap(SpriteBase sprite)
        {
            Bounds2 spriteBounds = sprite.GetlContentLocalBounds();

            sprite.GetContentWorldBounds(ref spriteBounds);
            return(pipeGap.Overlaps(spriteBounds));
        }
Exemple #12
0
 public void Setup(object itemData, IUIContainer c)
 {
     data                 = itemData as BaseCard;
     container            = c;
     cardNameLabel.text   = data.key;
     view.sprite          = SpriteBase.GetSprite(data.view + data.teamId.ToString());
     summonCostLabel.text = data.summonCost.ToString();
 }
Exemple #13
0
 private static async Task RenderSprite(Canvas2DContext context, SpriteBase sprite)
 {
     await context.DrawImageAsync(sprite.ElementRef,
                                  sprite.Bounds.X, sprite.Bounds.Y,
                                  sprite.Bounds.Width, sprite.Bounds.Height,
                                  sprite.Origin.X, sprite.Origin.Y,
                                  -sprite.Bounds.Width, -sprite.Bounds.Height);
 }
 public SpriteRendererComponentRef(SpriteBase sprite, SpriteRenderer comp, SortingGroupComponentRef sgCompRef, Consts.DrawLayers drawLayerOrig) : base(sprite, drawLayerOrig)
 {
     this.comp = comp;
     if (sgCompRef != null)
     {
         sgCompRef.AddToGroupList(this);
     }
 }
    public bool IsChildOf(SpriteBase sprite)
    {
        if (sprite.sgRef == null)
        {
            return(false);
        }

        return(srRef.IsChildOf(sprite.sgRef));
    }
    public void Init()
    {
        mousePos = Resources.Load <ScriptableVector2>("ScriptableObjects/v2_mouseWorldPos");
        Utility.RepositionZ(transform, (float)Consts.ZLayers.FrontOfWater);
        SetActive(false);

        clickRadSB = clickRadRefCircle.GetComponent <SpriteBase>();
        dragRadSB  = dragRadTracker.GetComponent <SpriteBase>();
    }
    // JOB SPECIFIC ACTIONS (just examples for now)

    protected override void OnSelectionScoop(SpriteBase sprite)
    {
        if ((sprite as ItemBase) == sailorCap)
        {
            capDonned = false;
        }

        base.OnSelectionScoop(sprite);
    }
Exemple #18
0
        /// <summary>
        /// Called when the shader parameters are to be configured before rendering.
        /// </summary>
        /// <param name="renderSystem">Instance of the <see cref="DeferredRenderSystem"/> we are using to render</param>
        /// <param name="sprite">The sprite we are rendering.</param>
        public void ConfigureShaderAndApplyPass(DeferredRenderSystem renderSystem, SpriteBase sprite)
        {
            base.ConfigureShader(renderSystem, "ApplyFlagsToOptionsMap");

            this.ShaderAsset.Parameters["viewProjection"].SetValue(renderSystem.GameCamera.GetViewProjectionMatrix(renderSystem));
            this.ShaderAsset.Parameters["cameraPosition"].SetValue(renderSystem.GameCamera.PixelPosition);
            this.ShaderAsset.Parameters["pixelOptions"].SetValue((int)sprite.RenderOptions / 255.0f);
            this.ShaderAsset.Parameters["specularReflectivity"].SetValue(sprite.SpecularReflectivity);
            this.ApplyPass(0);
        }
Exemple #19
0
        public void Potion_HP_Drink()
        {
            var sp = new SpriteBase();

            sp.MaxHp     = 100;
            sp.CurrentHp = 1;
            var potionHp = new PotionHP("微型生命药水", 1, 0.15m, 10);

            potionHp.Consume(1, sp);
        }
        public SpriteNode Attach(SpriteBase pNode)
        {
            // Go to Man, get a node from reserve, add to active, return it
            SpriteNode pSBNode = (SpriteNode)this.baseAdd();

            // Initialize SpriteBatchNode
            pSBNode.Set(pNode);

            return(pSBNode);
        }
Exemple #21
0
        public Alien()
        {
            string pattern = "#...#" +
                             ".###." +
                             "#.#.#" +
                             ".###." +
                             "#...#";

            Color  = ConsoleColor.Red;
            Sprite = SpriteBase.FromPattern(pattern, _height, _width);
        }
Exemple #22
0
        public Player()
        {
            string pattern = "..#.." +
                             ".###." +
                             "#####" +
                             ".###." +
                             "#...#";

            Color  = ConsoleColor.Yellow;
            Sprite = SpriteBase.FromPattern(pattern, 5, 5);
        }
        public void Attach(SpriteBase pNode)
        {
            // Go to Man, get a node from reserve, add to active, return it
            SpriteNode pSpriteNode = (SpriteNode)this.pSpriteNodeMan.Attach(pNode);

            // Initialize SpriteBatchNode
            pSpriteNode.Set(pNode, this.pSpriteNodeMan);

            // Back pointer
            this.pSpriteNodeMan.SetSpriteBatch(this);
        }
Exemple #24
0
    public override void Copy(SpriteRoot s)
    {
        base.Copy(s);
        if (!(s is SpriteBase))
        {
            return;
        }
        SpriteBase spriteBase = (SpriteBase)s;

        this.defaultAnim     = spriteBase.defaultAnim;
        this.playAnimOnStart = spriteBase.playAnimOnStart;
    }
        public AnimationControl(IPluginHost pluginHost, NANR ani)
        {
            InitializeComponent();
            Read_Language();

            this.pluginHost = pluginHost;
            this.palette    = pluginHost.Get_Palette();
            this.image      = pluginHost.Get_Image();
            this.sprite     = pluginHost.Get_Sprite();
            this.ani        = ani;
            isAni           = true;

            if (ani.Struct.abnk.nBanks == 0)
            {
                MessageBox.Show("No animations.");
                isAni                      = false;
                tempo.Enabled              = false;
                comboAni.Enabled           = false;
                btnNext.Enabled            = false;
                btnPlay.Enabled            = false;
                btnPrevious.Enabled        = false;
                btnSave.Enabled            = false;
                btnStop.Enabled            = false;
                txtTime.Enabled            = false;
                checkCeldas.Enabled        = false;
                checkEntorno.Enabled       = false;
                checkImage.Enabled         = false;
                checkNumeros.Enabled       = false;
                checkTransparencia.Enabled = false;
            }


            for (int i = 0; i < ani.Names.Length; i++)
            {
                comboAni.Items.Add(ani.Names[i]);
            }
            if (isAni)
            {
                comboAni.SelectedIndex = 0;
            }

            ShowInfo();
            Get_Ani();

            tempo.Stop();
            tempo.Interval = Convert.ToInt32(txtTime.Text);

            if (isAni)
            {
                aniBox.Image = bitAni[0];
            }
        }
    // Not anonymous, so as to be overridden in Crewman.cs
    protected virtual void OnSelectionScoop(SpriteBase sprite)
    {
        HoldItem(sprite as ItemBase);

        ItemCanScoop scoop = sprite as ItemCanScoop;

        waterWeight = scoop.capacity;
        float heldWeight = scoop.Weight + waterWeight;

        ActionQueueModTaskCounter(Consts.SCOOP_RATE - (strength - heldWeight));

        AnimTrigger("Scoop");
    }
Exemple #27
0
        public OAMEditor(XElement langxml, Bank bank, SpriteBase sprite, ImageBase image, PaletteBase palette)
        {
            InitializeComponent();
            this.bank      = bank;
            numOAM.Maximum = bank.oams.Length - 1;

            preview      = true;
            this.sprite  = sprite;
            this.image   = image;
            this.palette = palette;

            Read_Language(langxml);
        }
Exemple #28
0
        public OAMEditor(XElement langxml, Bank bank, SpriteBase sprite, ImageBase image, PaletteBase palette)
        {
            InitializeComponent();
            this.bank = bank;
            numOAM.Maximum = bank.oams.Length - 1;

            preview = true;
            this.sprite = sprite;
            this.image = image;
            this.palette = palette;

            Read_Language(langxml);
        }
Exemple #29
0
    protected void ActionQueueAccSplitIdx(int index, SpriteBase sprite)
    {
        if (!actPathSplit)
        {
            return;
        }

        steps.Add(splitStepsList[index]);
        steps[stepIdx].sprite = sprite;
        stepIdx++;

        splitStepsList.Clear();
    }
Exemple #30
0
    // Use this for initialization
    void Start()
    {
        //When the Bee object is first created instantiate the mainSprite in the center of the screen
        mainSprite       = (GameObject)Instantiate(warriorPrefab, this.transform.position, Quaternion.identity);
        mainSpriteScript = mainSprite.GetComponent <MountScript>();

        mainSprite.name                   = warriorPrefab.name;
        mainSpriteScript.OnBeeDeath      += KillBee;
        mainSpriteScript.OnStandingEnter += StartStanding;

        mainSprite.GetComponent <Animator>().runtimeAnimatorController            = MountArray[TeamNumber];
        mainSprite.transform.Find("Rider").GetComponent <SpriteRenderer>().sprite = RiderArray[PlayerNumber];
    }
Exemple #31
0
    public void showSecondFire(SpriteBase sprite)
    {
        Destroy(firstFire);

        Destroy(secondFireFront);
        Destroy(secondFireBehind);

        StaticData.createObjFromPrb(ref secondFireFrontPrb, "eft/Caiera/Skill_CAIERA30B_SecondFireFront", ref secondFireFront, character.transform, new Vector3(0, -26, 0));

        StaticData.createObjFromPrb(ref secondFireBehindPrb, "eft/Caiera/Skill_CAIERA30B_SecondFireBehind", ref secondFireBehind, character.transform, new Vector3(0, 101, 1));

        secondFireBehind.GetComponent<PackedSprite>().SetAnimCompleteDelegate(showThirdFire);
    }
Exemple #32
0
        private void DrawUIElement(UIObject uiObj, Rectangle?scissorRect)
        {
            int len = uiObj.Sprites.Count;

            for (int s = 0; s < len; s++)
            {
                SpriteBase sprite = uiObj.Sprites.Array[s];
                Rectangle  bounds = sprite.Bounds;
                if (scissorRect != null && scissorRect.Value.Intersects(bounds))
                {
                    sprite.Render(null, Space.Screen);
                }
            }
        }
Exemple #33
0
    // Use this for initialization
    void Start()
    {
        //When the Bee object is first created instantiate the mainSprite in the center of the screen
        mainSprite = (GameObject)Instantiate(warriorPrefab, this.transform.position, Quaternion.identity);
        mainSpriteScript = mainSprite.GetComponent<MountScript>();

        mainSprite.name = warriorPrefab.name;
        mainSpriteScript.OnBeeDeath += KillBee;
        mainSpriteScript.OnStandingEnter += StartStanding;

        mainSprite.GetComponent<Animator>().runtimeAnimatorController = MountArray[TeamNumber];
        mainSprite.transform.Find("Rider").GetComponent<SpriteRenderer>().sprite = RiderArray[PlayerNumber];

    }
        /// <summary>
        /// Creates a new composite animations from an instantiated list of animations
        /// </summary>
        /// <param name="i_Name">Animation name</param>
        /// <param name="i_AnimationLength">Animation length</param>
        /// <param name="i_BoundSprite">The animated sprite</param>
        /// <param name="i_Animations">List of animations (must be initialized)</param>
        public CompositeAnimation(
            string i_Name,
            TimeSpan i_AnimationLength,
            SpriteBase i_BoundSprite,
            params SpriteAnimation[] i_Animations)
            : base(i_Name, i_AnimationLength)
        {
            this.BoundSprite = i_BoundSprite;

            foreach (SpriteAnimation animation in i_Animations)
            {
                this.Add(animation);
            }
        }
Exemple #35
0
        public OAMEditor(string langxml, Bank bank, SpriteBase sprite, ImageBase image, PaletteBase palette)
        {
            InitializeComponent();
            this.bank = bank;
            numOAM.Maximum = bank.oams.Length - 1;
            numOffset.Maximum = (bank.data_size == 0)
                ? image.Tiles.Length / (0x20 << (int)sprite.BlockSize) - 1
                : bank.data_size / (0x20 << (int)sprite.BlockSize) - 1;

            preview = true;
            this.sprite = sprite;
            this.image = image;
            this.palette = palette;

            Read_Language(langxml);
        }
Exemple #36
0
    public void rotateFinish(SpriteBase sprite)
    {
        Destroy(sprite.gameObject);

        GameObject caller = grootObj[1] as GameObject;

        if(treePrb == null)
        {
            treePrb = Resources.Load("eft/Groot/SkillEft_GROOT30B_Tree") as GameObject;;
        }

        GRoot heroDoc = caller.GetComponent<GRoot>();

        tree = Instantiate(treePrb) as GameObject;
        tree.transform.position = heroDoc.transform.position + new Vector3(-4, 70, 0);

        boneGROOT30B_Tree = tree.GetComponent<BoneGROOT30B_Tree>();
        boneGROOT30B_Tree.ShowEnemyEft += ShowEnemyEft;
        boneGROOT30B_Tree.SkillKeyFrameEvent += treeShowFinish;
    }
 /// <summary>
 /// Initializes a new animation for the specified sprite with default name 
 /// ("AnimationManager") and length (infinite)
 /// </summary>
 /// <param name="i_BoundSprite">The sprite which is animated</param>
 public CompositeAnimation(SpriteBase i_BoundSprite)
     : this("AnimationsManager", TimeSpan.Zero, i_BoundSprite, new SpriteAnimation[] { })
 {
     this.Enabled = false;
 }
Exemple #38
0
	// Helper method that hides a sprite using the method
	// set for this animation (hiding vs deactivation).
	protected void HideSprite(SpriteBase sp, bool tf)
	{
		if (deactivateNonPlaying)
			if (deactivateRecursively)
				sp.gameObject.SetActiveRecursively(!tf);
			else
				sp.gameObject.active = !tf;
		else
			sp.Hide(tf);
	}
Exemple #39
0
	/// <summary>
	/// Sets the delegate to be called each frame of animation.
	/// </summary>
	/// <param name="del">The delegate to be called each frame of animation.</param>
	public void SetAnimFrameDelegate(SpriteBase.AnimFrameDelegate del)
	{
		animFrameDelegate = del;

		for(int i=0; i<animations.Length; ++i)
		{
			animations[i].SetAnimFrameDelegate(animFrameDelegate);
		}
	}
Exemple #40
0
	public void SetAnimFrameDelegate(SpriteBase.AnimFrameDelegate frameDel)
	{
		for (int i = 0; i < spriteAnims.Length; ++i)
			if (spriteAnims[i] != null)
				if (spriteAnims[i].sprite != null)
					spriteAnims[i].sprite.SetAnimFrameDelegate(frameDel);
	}
Exemple #41
0
	// Delegate that is called when an animation finishes:
	void AnimFinished(SpriteBase sp)
	{
		// See if we can't advance to the next animation:
		if ((curAnim + stepDir) >= spriteAnims.Length || (curAnim + stepDir) < 0)
		{
			// See if we need to loop (if we're reversing, we don't loop until we get back to the beginning):
			if (stepDir > 0 && pingPong)
			{
				stepDir = -1;	// Reverse direction of playback

				// Bounce back from the end:
				((AutoSpriteBase)sp).PlayAnimInReverse(spriteAnims[curAnim].anim, spriteAnims[curAnim].anim.GetFrameCount() - 2);
				return;

				// See if we need to tell our first animation
				// to loop us back again in anticipation of
				// another loop iteration:
				// 				if(loopCycles == -1 || numLoops < loopCycles)
				// 				{
				// 					spriteAnims[0].anim.loopReverse = true;
				// 				}

				// Proceed
			}
			else
			{
				// See if we can't loop:
				if (numLoops + 1 > loopCycles && loopCycles != -1)
				{
					isRunning = false;

					// Unset our delegate:
					sp.SetAnimCompleteDelegate(null);

					// Notify that we're ending:
					if (endDelegate != null)
						endDelegate(this);
					return;
				}
				else
				{
					// Loop the animation:
					++numLoops;

					if (pingPong)
					{
						// Bounce back from the first frame:
						spriteAnims[curAnim].sprite.PlayAnim(spriteAnims[curAnim].anim, 1);
						stepDir *= -1;
						return;
					}
					else
					{
						// Hide the current sprite
						HideSprite(sp, true);

						// Unset our delegate:
						sp.SetAnimCompleteDelegate(null);

						// Start back at the first animation:
						curAnim = 0;
					}
				}
			}
		}
		else
		{
			// Unset our delegate:
			sp.SetAnimCompleteDelegate(null);
			HideSprite(sp, true);
			curAnim += stepDir;
		}

		// Proceed to play the next animation:
		HideSprite(spriteAnims[curAnim].sprite, false);
		spriteAnims[curAnim].sprite.SetAnimCompleteDelegate(AnimFinished);
		if (stepDir > 0)
			spriteAnims[curAnim].Play();
		else
			spriteAnims[curAnim].PlayInReverse();
	}
Exemple #42
0
    // Update is called once per frame
    void Update()
    {
        float halfScreenWidth = Camera.main.orthographicSize * (float)Screen.width / (float)Screen.height;
        float halfSpriteWidth = mainSprite.GetComponent<SpriteRenderer>().bounds.size.x / (float)2.0;

        if (mainSprite.transform.position.x > (halfScreenWidth - halfSpriteWidth) || mainSprite.transform.position.x < -(halfScreenWidth - halfSpriteWidth))
        {
            if (secondarySprite == null)
            {
                if (mainSprite.transform.position.x > 0)
                {
                    //Create secondary sprite on left side of screen
                    secondarySprite = Instantiate(mainSprite, new Vector3(mainSprite.transform.position.x - 2 * halfScreenWidth, mainSprite.transform.position.y, 0), Quaternion.identity) as GameObject;
                    secondarySpriteScript = secondarySprite.GetComponent<MountScript>();
                    //Rename the object to prevent multiple (clone) labels from being added
                    secondarySprite.name = mainSprite.name;
                    secondarySprite.SendMessage("StandingAnimation", lastStandingState);

                }
                else
                {
                    //Create secondary sprite on right side of screen
                    secondarySprite = Instantiate(mainSprite, new Vector3(mainSprite.transform.position.x + 2 * halfScreenWidth, mainSprite.transform.position.y, 0), Quaternion.identity) as GameObject;
                    secondarySpriteScript = secondarySprite.GetComponent<MountScript>();
                    //Rename the object to prevent multiple (clone) labels from being added
                    secondarySprite.name = mainSprite.name;
                    secondarySprite.SendMessage("StandingAnimation", lastStandingState);
                }
                secondarySprite.GetComponent<Rigidbody2D>().isKinematic = true;
            }
            else
            {
                if (mainSprite.transform.position.x > (halfScreenWidth + halfSpriteWidth) || mainSprite.transform.position.x < -(halfScreenWidth + halfSpriteWidth))
                {
                    //Make the secondary sprite the main sprite
                    secondarySprite.gameObject.GetComponent<Rigidbody2D>().velocity = mainSprite.gameObject.GetComponent<Rigidbody2D>().velocity;
                    secondarySpriteScript.horizontalInput = mainSpriteScript.horizontalInput;
                    secondarySprite.GetComponent<Rigidbody2D>().isKinematic = false;
                    mainSprite.GetComponent<MountScript>().OnBeeDeath -= KillBee;
                    mainSprite.GetComponent<MountScript>().OnStandingEnter -= StartStanding;

                    Destroy(mainSprite);
                    mainSprite = secondarySprite;
                    mainSpriteScript = secondarySpriteScript;
                    mainSprite.GetComponent<MountScript>().OnBeeDeath += KillBee;
                    mainSprite.GetComponent<MountScript>().OnStandingEnter += StartStanding;

                    secondarySprite = null;
                }
                else
                {
                    //Move secondary sprite with main sprite
                    secondarySprite.gameObject.GetComponent<Rigidbody2D>().velocity = mainSprite.GetComponent<Rigidbody2D>().velocity;
                }
            }
        }
        else
        {
            if (secondarySprite != null)
            {
                Destroy(secondarySprite);
            }
        }
    }
Exemple #43
0
	public void Init(int idx, AnimCompletedDelegate del, SpriteBase.AnimFrameDelegate frameDel)
	{
		endDelegate = del;
		index = idx;

		List<SuperSpriteAnimElement> anims = new List<SuperSpriteAnimElement>();

		for (int i = 0; i < spriteAnims.Length; ++i)
			if (spriteAnims[i] != null)
				if (spriteAnims[i].sprite != null)
				{
					spriteAnims[i].Init();

					// Only save the ones that are valid
					// so we don't have to check them
					// constantly later on:
					anims.Add(spriteAnims[i]);

					if(frameDel != null)
						spriteAnims[i].sprite.SetAnimFrameDelegate(frameDel);

					// Hide each sprite by default:
					HideSprite(spriteAnims[i].sprite, true);
				}

		spriteAnims = anims.ToArray();
	}
	// Adds the specified sprite to the animation list.
	// s: A reference to the sprite to be animated.
	public static void Add(SpriteBase s)
	{
		if(head != null)
		{
			s.next = head;
			head.prev = s;
			head = s;
		}
		else
		{
			head = s;

			// We've got our first item, so
			// we need to start the pump:
			Instance.StartAnimationPump();
		}
	}
Exemple #45
0
    public void showThirdFire(SpriteBase sprite)
    {
        Destroy(secondFireFront);
        Destroy(secondFireBehind);

        Destroy(thirdFireFront);
        Destroy(thirdFireBehind);

        StaticData.createObjFromPrb(ref thirdFireFrontPrb, "eft/Caiera/Skill_CAIERA30B_ThirdFireFront", ref thirdFireFront, character.transform, new Vector3(0, 259, 0));

        StaticData.createObjFromPrb(ref thirdFireBehindPrb, "eft/Caiera/Skill_CAIERA30B_ThirdFireBehind", ref thirdFireBehind, character.transform, new Vector3(0, 270, 1));
    }
Exemple #46
0
 protected void landMineRotationFinish(SpriteBase sprite)
 {
     this.isEnabled = false;
     landMineRotationPackedSprite.gameObject.SetActive(false);
     explodeEftPackedSprite.gameObject.SetActive(true);
     explodeEftPackedSprite.PlayAnim(0);
     StartCoroutine(damage());
 }
 public void fruitExplodeFinish(SpriteBase sprite)
 {
     fruitExplodeFinishCount++;
     if(fruitExplodeFinishCount == 2)
     {
         if(ShowEnemyEft != null)
         {
             ShowEnemyEft(this);
         }
     }
     else if(fruitExplodeFinishCount == fruitPackedSpriteList.Count)
     {
         restart();
     }
 }
	// Removes the specified sprite from the animation list,
	// thereby not receiving animation updates.
	// s: A reference to the sprite to be removed.
	public static void Remove(SpriteBase s)
	{
		if(head == s)
		{
			head = (SpriteBase) s.next;
			
			// See if we need to stop the pump:
			if(head == null)
			{
				StopAnimationPump();
			}
		}
		else
		{
			if(s.next != null)
			{	// Connect either side:
				s.prev.next = s.next;
				s.next.prev = s.prev;
			}
			else if(s.prev != null)
			{
				// Removing the last item:
				s.prev.next = null;
			}
		}
		s.next = null;
		s.prev = null;
	}
 // Use this for initialization
 void Start()
 {
     mainSpriteBase=this;//
 }
Exemple #50
0
 protected void atkFinish(SpriteBase sprite)
 {
     this.isAttack = false;
     hideEft();
 }
Exemple #51
0
	// Helper method that hides a sprite using the method
	// set for this animation (hiding vs deactivation).
	protected void HideSprite(SpriteBase sp, bool tf)
	{
		if (deactivateNonPlaying)
		{
#if UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_4_7 || UNITY_4_8 || UNITY_4_9
			sp.gameObject.SetActive(!tf);	
#else
			if (deactivateRecursively)
				sp.gameObject.SetActiveRecursively(!tf);
			else
				sp.gameObject.active = !tf;
#endif
		}
		else
			sp.Hide(tf);
	}
 /// <summary>
 /// Stores original bound sprite state
 /// </summary>
 protected virtual void CloneSpriteInfo()
 {
     if (m_OriginalSpriteInfo == null)
     {
         m_OriginalSpriteInfo = m_BoundSprite.ShallowClone();
     }
 }
/*
	void Update()
	{
		if(!pumpIsRunning)
			return;	// Abort

		cur = head;
		
		while(cur != null)
		{
			cur.StepAnim(Time.deltaTime);
			cur = cur.next;
		}
	}
*/

	// The coroutine that drives animation:
	protected static IEnumerator AnimationPump()
	{
#if !USE_DELTA_TIME
		float startTime = Time.realtimeSinceStartup;
		float time;
#endif
		float elapsed;
		SpriteBase next;

		pumpIsDone = false;

		while (pumpIsRunning)
		{
#if !PUMP_EVERY_FRAME
			yield return new WaitForSeconds(animationPumpInterval);
#else
			yield return null;
#endif


#if USE_DELTA_TIME
			elapsed = Time.deltaTime;
#else
			time = Time.realtimeSinceStartup;
			elapsed = time - startTime;
			startTime = time;
#endif

			// Start at the beginning:
			cur = head;

			while( cur != null )
			{
				next = (SpriteBase)cur.next;
				cur.StepAnim(elapsed);
				cur = next;
			}
		}

		pumpIsDone = true;
	}
Exemple #54
0
 protected void atkFinish(SpriteBase sprite)
 {
     attackEftGameObject.SetActive(false);
     smokeEftPackedSprite.gameObject.SetActive(true);
     smokeEftPackedSprite.PlayAnim(0);
 }