GithubHelp home page GithubHelp logo

mixer-unity's Introduction

Overview

The Axie Mixer is built upon Spine Animation but with some customization for our needs. The AxieMixer will help you to create the SkeletonData which you can use with Spine and use it as normal.

Install

⚠️ The package requires Spine Runtime Library (spine-unity 3.8 2021-11-10). You need to download it manualy, and put it on Plugins folder.

Usage

Initialize Axie Mixer

To initialize the Axie Mixer, you need to call Mixer.Init() only once at the start of the game. The best place for this method is in the loading scene.

Calling Mixer.Init() multiple times will do nothing.

Create Axie Spine

To create an axie spine, you will need to know the Axie Id and its Genes

Then create an object in scene with SkeletonAnimation component

var skeletonAnimation = GetComponent<SkeletonAnimation>();
Mixer.SpawnSkeletonAnimation(skeletonAnimation, axieId, genesStrting);

API

Mixer.SpawnSkeletonAnimation(
    SkeletonAnimation skeletonAnimation, 
    string axieId, 
    string genesStr
)
  • skeletonAnimation: Main spine component for rendering and controling animation

  • axieId: Axie id

  • genesString: Axie genes, must be gene 512

Tips

You might need to scale down the SkeletonAnimation to the desired size.

To flip the Axie, please use the scaleX field of the skeleton. Example: skeletonAnimation.skeleton.ScaleX = -1

Create Axie Spine For UICanvas

Creating Axie Spine for UICanvas is quite the same as above, the different is you will need to use SkeletonGraphic instead of SkeletonAnimation

Mixer.SpawnSkeletonAnimation(
    SkeletonGraphic skeletonGraphic, 
    string axieId, 
    string genesStr
)

Playing Animation

You can get all available animation names using this snippet.

List<string> animationList = Mixer.Builder.axieMixerMaterials.GetMixerStuff(AxieFormType.Normal).GetAnimatioNames();

Playing animation.

skeletonAnimation.state.SetAnimation(0, "action/idle/normal", true);
// The above code will play Idle animation with looping 

// For Skeleton Graphic
skeletonGraphic.AnimationState.SetAnimation(0, "action/idle/normal", true);

// You can find more information about the function here http://en.esotericsoftware.com/spine-applying-animations

Building Project

You need add AxieMixerShaderVariants into Preloaded Shaders (Project Settings/Graphics/Shader Loading)

Scene demo

In the asset, there are 2 demos that you can explore. You can find these scenes:

  • DemoMixer: or so called PlayGround.

  • FlappyAxie: This is a minigame based on FlappyBird. In this demo, you can find the AxieFigure class which helps to setup SkeletonAnimation automatically. (The axie id and genes are static though)

mixer-unity's People

Contributors

paladinlll avatar phuong-axie avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

mixer-unity's Issues

Mask

why i cant mask the Skeleton Animation with a Mask or Sprite Mask? I try but it's not working.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.