存档

‘unity3d’ 分类的存档

cocos2d-x using_ns_cc

2015年10月7日 没有评论

I need to know what is the functionality of this sentence in Cocos2D-X in C++:

USING_NS_CC

Example in code:

#include "HelloWorldScene.h"
#include "SimpleAudioEngine.h"
#include "GameOverScene.h"

USING_NS_CC;

HelloWorld::~HelloWorld()
{
    if (_targets)
    {
        _targets->release();
        _targets = NULL;
    }

    if (_projectiles)
    {
        _projectiles->release();
        _projectiles = NULL;
    }

    // cpp don't need to call super dealloc
    // virtual destructor will do this
}

From Learning Cocos2d-x Game Development from author Siddharth Shekar the macro

 USING_NS_CC;

is used to set the namespace to Cocos2d, aka using namespace cocos2d;

Except from setting the namespace that macro also #include CCPlatformMacros.h which loads additional macros.

分类: stackoverflow精选, unity3d 标签:

Error while changing player animation

2015年7月23日 没有评论

First of all , I’m using cocos2d 3.6
Everything works well until I press right arrow key on keyboard which execute the startRunning() function from keypress event listener,actions stopped successfully but on the next line ,this->runAction(Animate::create( runAnimation));, I get error.
runAnimation is OK.I guess the problem is in running new Action but I dont know what is it.

here’s the code:

#pragma once

#include "cocos2d.h"

using namespace cocos2d;

const int DIR_RIGHT = 1;
const int DIR_LEFT = -1;




class CPlayer: public Sprite
{

private:
    Animation* idleAnimation;
    Animation* runAnimation;
    Animation* bowAnimation;
    Animation* climbAnimation;
    SpriteFrame* jumpFrame;
    SpriteFrame* fallFrame;
    SpriteFrame* wallJumpFrame;

    boolean onGround = true;
    boolean running = false;
    int dir = DIR_RIGHT;
    float movementSpeed = 50; //50 unit in world space 
    float stateTime=0;
public:

    Animation* createAnimation(const char* format, float delay, bool loop){

        Animation* animation = Animation::create();
        char str[100] = { 0 };
        int frameIndex = 1;
        do
        {
            sprintf(str, format, frameIndex);

            auto frame = SpriteFrameCache::getInstance()->getSpriteFrameByName(str);
            if (frame == NULL)
                break;
            animation->addSpriteFrame(frame);
            Texture2D::TexParams texParams = { GL_NEAREST, GL_NEAREST, GL_CLAMP_TO_EDGE, GL_CLAMP_TO_EDGE };
            frame->getTexture()->setTexParameters(texParams);
            frameIndex++;
        } while (true);
        int loops = 1;
        if (loop)
            loops = -1;
        animation->setDelayPerUnit(delay);
        animation->setLoops(loops);


        return animation;

    }

    CPlayer(){

        idleAnimation = createAnimation("Idle/player_idle_%d.png", .2f, -1);
        runAnimation = createAnimation("Run/player_run_%d.png", .5f, -1);
        bowAnimation = createAnimation("Bow/bow_%d.png", .2f, -1);
        climbAnimation = createAnimation("Climb/player_climb_%d.png", .2f, -1);
        jumpFrame = SpriteFrameCache::getInstance()->getSpriteFrameByName("Fall-Jump-WallJ/player_climb_jump.png");
        fallFrame = SpriteFrameCache::getInstance()->getSpriteFrameByName("Fall-Jump-WallJ/player_climb_fall.png");
        wallJumpFrame = SpriteFrameCache::getInstance()->getSpriteFrameByName("Fall-Jump-WallJ/player_climb_wall_jump.png");

        this->runAction(Animate::create(idleAnimation));
    }

    CREATE_FUNC(CPlayer);

    void startRunning(){
        running = true;

        if (onGround){
            this->stopAllActions();
            this->runAction(Animate::create( runAnimation));
        }
    }

    void endRunning(){
        running = false;
        if (onGround){
            this->stopAllActions();
            this->runAction(Animate::create(idleAnimation));
        }

    }

    void update(float delta){
        stateTime += delta;
        if (onGround && running){
            this->setPositionX(this->getPositionX() + delta*  movementSpeed*dir);

        }
    }

    void headToRight(){
        this->setFlipX(false);
        dir = DIR_RIGHT;
    }

    void headToLeft(){
        this->setFlippedX(true);
        dir = DIR_LEFT;
    }



};

Your createAnimation method returns an autoreleased animation object, which is released before you use it.

To fix this issue you need to retain your autoreleased objects after you create them, and release them in destructor or when you don’t need them no more:

CPlayer(){
    idleAnimation = createAnimation("Idle/player_idle_%d.png", .2f, -1);
    runAnimation = createAnimation("Run/player_run_%d.png", .5f, -1);
    bowAnimation = createAnimation("Bow/bow_%d.png", .2f, -1);
    climbAnimation = createAnimation("Climb/player_climb_%d.png", .2f, -1);
    idleAnimation->retain();
    runAnimation->retain();
    bowAnimation->retain();
    climbAnimation->retain();
    jumpFrame = SpriteFrameCache::getInstance()->getSpriteFrameByName("Fall-Jump-WallJ/player_climb_jump.png");
    fallFrame = SpriteFrameCache::getInstance()->getSpriteFrameByName("Fall-Jump-WallJ/player_climb_fall.png");
    wallJumpFrame = SpriteFrameCache::getInstance()->getSpriteFrameByName("Fall-Jump-WallJ/player_climb_wall_jump.png");

    this->runAction(Animate::create(idleAnimation));
}

virtual ~CPlayer() {
    idleAnimation->release();
    runAnimation->release();
    bowAnimation->release();
    climbAnimation->release();
}
分类: stackoverflow精选, unity3d 标签:

Sprite tracking touch

2015年7月14日 没有评论

I want to implement tracking (following) touch by a sprite with rotation in cocos2d-x. You can see this effect here: https://www.youtube.com/watch?v=RZouMyyNGG8 (2:10).

Here’s my code in touchMove:

_destinationX = touchPoint.x;
_destinationY = touchPoint.y;

_dx = _destinationX - draggedItem->getPositionX();
_dy = _destinationY - draggedItem->getPositionY();

_vx = _dx;
_vy = _dy;

float d = sqrtf((_dx*_dx)+(_dy*_dy));

//nice easing when near destination
if (d < 50 && d > 3){
    _vx *= d / 50.0f;
    _vy *= d / 50.0f;
}
else if(d <= 3){
    _vx = _vy = 0;
}

draggedItem->setPosition(draggedItem->getPosition() + Point(_vx, _vy));

float rad = atan2(_dy, _dx);
float rotateTo = CC_RADIANS_TO_DEGREES(-rad);
if (rotateTo > draggedItem->getRotation() + 180) rotateTo -= 360;
if (rotateTo < draggedItem->getRotation() - 180) rotateTo += 360;

draggedItem->setRotation(rotateTo);

It works, but sprite destination point is on it’s center, so if I on touchBegin won’t start from it’s center it’s not looking too well.

So I’m calculating offset in touch begin as well as initial rotation:

offsetPoint = Point(touchPoint.x - draggedItem->getPositionX(), touchPoint.y - draggedItem->getPositionY());
offsetRotation = atan2(offsetPoint.y, offsetPoint.x);

I also added these lines in touch move (on the top):

float alfa = offsetRotation;
float beta = CC_DEGREES_TO_RADIANS(draggedItem->getRotation());
float gamma = alfa + beta;

float radius = offsetPoint.length();
float ax = cosf(gamma) * radius;
float ay = sinf(gamma) * radius;

so destination would be:

_destinationX = touchPoint.x + ax;
_destinationY = touchPoint.y + ay;

But it doesn’t work, where’s an issue? Sprite is jumping all around.

As I’m not familiar at all with Obj-C or C++, I’m gonna give you the answer in Swift. Then, you’ll be able to either insert it into your project or ‘translate’ to Obj-C/C++. Anyway:

Inside the file that represents your gameplay scene, declare a variable that keeps track of whether the user is currently touching the screen or not. I’ll also assume the sprite you want to follow the touch is represented by some variable (named ‘sprite’ here):

var touchingScreen:Bool = false // needs 'false' as initial value.
weak var sprite:CCSprite!; // represents a connection to the sprite.

Then, you’ll also want a variable that represents the difference between the value of the point currently being touched and the point your sprite is located in the x and y axises:

var diffTouchSpriteX:CGFloat!; // not necessary to initialize it with any default value.
var diffTouchSpriteY:CGFloat!; // same.

The next step is to update these two variables’ values when necessary. Lets create a method for that:

func updateDiff(touchX: CGFloat, touchY: CGFloat) {
  self.diffTouchSpriteX = touchX - self.sprite.position.x;
  self.diffTouchSpriteY = touchY - self.sprite.position.y;
}

Now it’s time to make use of the touch methods provided for handling the touch input at specific moments. Let’s assign a value to diffTouchSpriteX and diffTouchSpriteY variables and set touchingScreen to true when the user touches the screen, update diffTouchSpriteX and diffTouchSpriteY values when the user moves its finger on the screen and finally set touchingScreen to false once the touch is interrupted:

override func touchBegan(touch: CCTouch!, withEvent event: CCTouchEvent!) {
  self.updateDiff(touch.locationInWorld().x, touch.locationInWorld().y);
  self.touchingScreen = true;
}

override func touchMoved(touch: CCTouch!, withEvent event: CCTouchEvent!) {
  self.updateDiff(touch.locationInWorld().x, touch.locationInWorld().y);
}

override func touchEnded(touch: CCTouch!, withEvent event: CCTouchEvent!) {
  self.touchingScreen = false;
}

override func touchCancelled(touch: CCTouch!, withEvent event: CCTouchEvent!) {
  self.touchingScreen = false;
}

Finally, the last step. Inside the Cocos2d method fixedUpdate(), add a conditional to move the character if the screen is being currently touched:

override func fixedUpdate(delta: CCTime) {
  if (self.touchingScreen) {
    self.sprite.runAction(CCActionMoveBy(duration: 1/ 60, position: CGPoint(x: self.diffTouchSpriteX / 60, y: self.diffTouchSpriteY / 60)));
  }
}

The fixedUpdate() cocos2d method runs at a constant rate (1 time each second, if I remember well). The runAction() method here will update the sprite position by adding ‘x’ to its ‘x’ value of its current position and ‘y’ to its ‘y’ value of its current position. So, at this rate it would take one second for the sprite to reach the current touch location, but this of course is something you can easily manipulate.

分类: stackoverflow精选, unity3d 标签:

EXC_BAD_ACCESS at lauch for EAGLContext renderbufferStorage: fromDrawable: in Cocos2d app whie debugging

2015年7月14日 没有评论

Using default cocos2d-swift app I’m receiving the error EXC_BAD_ACCESS on my iPad Mini 2 at the line:

BOOL rb_status = [_context renderbufferStorage:GL_RENDERBUFFER fromDrawable:layer];

But if I try to launch the app without debug all works fine. If I use debug on any virtual device I receive no error too.
Why it doesn’t work? How to remove this error?

Looks like this is an issue on certain devices on iOS 8.3+. It works for me on almost all devices but the iPad mini 2 fails for me as well. The short of it is that there’s nothing wrong with the call itself. Seems to be an Xcode bug with those devices for some reason. You can get around it (until Apple fixes it) by:

In Xcode, go to Product -> Scheme -> Edit Scheme …
And for the Run Debug configuration (on left side) choose “Options” (on right side) and configure “GPU Frame Capture” as Disabled.

For more information, check out this thread:
https://github.com/BradLarson/GPUImage/issues/2022#issuecomment-118943746

I found the device hadn’t got the last iOS version. When I updated the iOS version of the devices the error has removed.

分类: stackoverflow精选, unity3d 标签:

How to disable logs from external APIs in Android

2015年4月29日 没有评论

I have a Cocos2d-x project and I wish to disable all the logs from the external JARs that I’ve attached, from Flurry to Pushwoosh, there are many external API’s. Is there any way to remove the logs for these?

I tried setting,
android:debuggable="false"
in the AndroidManifest.xml, but no use,

Also in proguard-project.txt, I set,

-assumenosideeffects class android.util.Log {
    public static *** d(...);
    public static *** w(...);
    public static *** v(...);
    public static *** i(...);
}

But still in the Release build, the logs are being seen. Any help on this would be great!

分类: stackoverflow精选, unity3d 标签:

Cocos2d-js: Custom TTF font won't display in Android

2015年4月12日 没有评论

I define the font resources with

var res = {
   indieflower_ttf: {type:"font", name:"IndieFlower", srcs:["res/fonts/IndieFlower.ttf"]},
}

And create a TTF label with:

var text = cc.LabelTTF.create(text, "IndieFlower", bubble.fontsize, cc.size(60,0),cc.TEXT_ALIGNMENT_LEFT, cc.VERTICAL_TEXT_ALIGNMENT_TOP);

and will display is ok in Firefox and Chrome, but will show the default font (Arial) on Android.

What else is to do? I checked the thread Cocos2d-js: How to use a custom ttf font on android devices?, but it doesn’t help.

The problem is, that the native platforms need the full path of the ttf font, while the html platform needs the font name. I got two solutions from the cocos2d-x forum:

  1. Use bitmap fonts. (Yes … but I wanted to have ttf)

  2. Code it:

In the resource file I have now:

var res = {
    indieflower_ttf: {type:"font", name:"IndieFlower", srcs:["res/fonts/IndieFlower.ttf"]},
}

Then a helper function:

var _b_getFontName = function(resource) {
    if (cc.sys.isNative) {
        return resource.srcs[0];
    } else {
        return resource.name;
    }
}

And to create a label:

var text = cc.LabelTTF.create("text", _b_getFontName(res.indieflower_ttf), 48, cc.size(300,0),cc.TEXT_ALIGNMENT_CENTER, cc.VERTICAL_TEXT_ALIGNMENT_TOP);
分类: stackoverflow精选, unity3d 标签:

Swift Version of Cocos2d Code : sprite1.colorRGBA

2015年4月9日 没有评论

I used below cocos2d code and worked:

CCSprite *sprite1 = [[CCSprite alloc] init];
sprite1.position = ccp(SW*0.1f, SH*0.82f);
sprite1.normalMapSpriteFrame = normalMap;
sprite1.effect = glass;
sprite1.colorRGBA = [CCColor colorWithRed:0.0f green:0.0f blue:0.0f alpha:0.0f];

Now tried to port it to Swift, but getting error for colorRGBA last line. Help me to get right code.

    var sprite1 = CCSprite.node() as CCSprite
    sprite1.position = ccp(SW*0.1, SH*0.82);
    sprite1.normalMapSpriteFrame = normalMap;
    sprite1.effect = glass;
    sprite1.colorRGBA =  ______ ?

Just created a new project with SpriteBuilder in Swift, tried this and all worked:

var sprite = CCSprite()    
sprite.colorRGBA = CCColor(red: 0.0, green: 0.0, blue: 0.0, alpha: 0.0)

Maybe you need to look at official documentation or this answer about bridging headers? They will help you to use Objective-C classes in Swift.

I did not test this…but you can try

sprite1.colorRGBA =  UIColor(red: 0.0, green: 0.0, blue: 0.0, alpha: 0.0) 
分类: stackoverflow精选, unity3d 标签:

Cannot implicitly convert type `bool' to `UnityEngine.RaycastHit'

2015年3月28日 没有评论

Hi I tried to cast a line from next to gameObject to gameObject:

bool Valid(Vector3 direction)
{
    Vector3 position = transform.position;
    RaycastHit hit = Physics.Linecast (position + direction, direction);
    return (hit.collider == GetComponent<Collider>());
}

Error:

Cannot implicitly convert type bool' toUnityEngine.RaycastHit’

Physics.Linecast returns true if there is any collider intersecting the line between start and end, it does not return a RaycastHit.

You have to add the hit variable as the third parameter:

RaycastHit hit;
Physics.Linecast(position + direction, direction, out hit);

See the API for more info.

分类: stackoverflow精选, unity3d 标签:

Repeating OpenGL-es texture bound to hills in cocos2d 3.2

2015年3月12日 没有评论

ORIGINAL ARTICLE

I am in the process of trying to implement raywenderlich’s tutorial on generating hills with repeating striped coordinates using cocos2d, This article was written for Cocos2D, and as I am trying to port it to Cocos2Dx 3.2 This means updating it for openGl-es 2. So far everything has worked perfectly, However I am having problems with getting the texture of the hill to repeat properly and also after some repeatation the texture start degrade …
please help me to get texture properly…….
Here is my code:

#define Point_FROM_B2VEC(v) Point((v.x*PTM_RATIO),(v.y*PTM_RATIO))
        #define B2VEC_FROM_Point(v) b2Vec2(v.x/PTM_RATIO,v.y/PTM_RATIO)
    #define PTM_RATIO       32
    #define MAX_HILL_POINTS 15
    #define MAX_SEGMENTS    MAX_HILL_POINTS*10
    #define MAX_COORDINATES 600

        Point hillTopVertices[MAX_COORDINATES],hillBottomVertices[MAX_COORDINATES];
            Point hillTopTexCoords[MAX_COORDINATES];
     Point hillBottomTexCoords[MAX_COORDINATES];

            GLuint         terraintopTexId, terrainBottomTexId;
     float         terrainTopTexSize,  terrainBottomTexSize;

Sending the hills the texture:

         texture = Director::getInstance()->getTextureCache()->addImage("surface.png");

            terraintopTexId = texture->getName();
            terrainTopTexSize = texture->getPixelsWide()/2;

    //terrain top texture
        texture1 = Director::getInstance()->getTextureCache()->addImage("old_stone_wall_textures_v3_3000x2000_1.jpg");


        terrainBottomTexId = texture1->getName();
        terrainBottomTexSize = texture1->getPixelsWide()/2;



void Terrain::generateCoordinates()
{
    int nTopVertCount = 0;
     int nTopVertCount1 = 0;

    //get the hill vertex and texcoordinates
    for(short i = 0; i < MAX_SEGMENTS; ++i)
    {
        Point point1 = Point_FROM_B2VEC(vertices[i]);
        Point point2 = Point_FROM_B2VEC(vertices[i+1]);






        CCLOG("%f",terrainBottomTexSize);

        hillTopVertices[nTopVertCount1]      = Point(point1.x, point1.y+16);
        hillTopTexCoords[nTopVertCount1++]   = Point(point1.x/terrainTopTexSize, 1);
        hillTopVertices[nTopVertCount1]      = Point(point2.x, point2.y+16);
        hillTopTexCoords[nTopVertCount1++]   = Point(point2.x/terrainTopTexSize, 1);

        hillTopVertices[nTopVertCount1]      = Point(point1.x, point1.y-16);
        hillTopTexCoords[nTopVertCount1++]   = Point(point1.x/terrainTopTexSize, 0);
        hillTopVertices[nTopVertCount1]      = Point(point2.x, point2.y-16);
        hillTopTexCoords[nTopVertCount1++]   = Point(point2.x/terrainTopTexSize, 0);

    }

        for(short i = 0; i < MAX_SEGMENTS; ++i)
        {
            Point point1 = Point_FROM_B2VEC(vertices[i]);
            Point point2 = Point_FROM_B2VEC(vertices[i+1]);

        hillBottomVertices[nTopVertCount]      = Point(point1.x, point1.y-terrainBottomTexSize+1);
        hillBottomTexCoords[nTopVertCount++]   = Point(point1.x/terrainBottomTexSize, 1);
        hillBottomVertices[nTopVertCount]      = Point(point2.x, point2.y-terrainBottomTexSize+1);
        hillBottomTexCoords[nTopVertCount++]   = Point(point2.x/terrainBottomTexSize, 1);

        hillBottomVertices[nTopVertCount]      = Point(point1.x, point1.y+2);
        hillBottomTexCoords[nTopVertCount++]   = Point(point1.x/terrainBottomTexSize, 0);
        hillBottomVertices[nTopVertCount]      = Point(point2.x, point2.y+2);
        hillBottomTexCoords[nTopVertCount++]   = Point(point2.x/terrainBottomTexSize, 0);
        }
        //energy adding

        //CCLOG("hillsegment---%d,pointx---%f,pointy---%f,offset--%f",i,point1.x,point1.y,offsetX);









}
void Terrain::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags)
{


    Node::draw(renderer, transform, flags);

    _renderCmds[0].init(0.0f);
    _renderCmds[0].func = CC_CALLBACK_0(Terrain::onDraw, this, transform);
    renderer->addCommand(&_renderCmds[0]);



}
void Terrain::onDraw(const Mat4 &transform) {



    auto glProgram = getGLProgram();
    glProgram->use();
    glProgram->setUniformsForBuiltins(transform);

    GL::bindTexture2D( terrainBottomTexId );
    GL::enableVertexAttribs( GL::VERTEX_ATTRIB_FLAG_POS_COLOR_TEX );

    glBindBuffer(GL_ARRAY_BUFFER, 0);
    glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_POSITION);
    glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 2, GL_FLOAT, GL_FALSE, 0, hillBottomVertices);
    glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_TEX_COORD, 2, GL_FLOAT, GL_FALSE, 0, hillBottomTexCoords);
    glDrawArrays(GL_TRIANGLE_STRIP, 0, (GLsizei)MAX_COORDINATES);

    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);

    GL::bindTexture2D(terraintopTexId );
    GL::enableVertexAttribs( GL::VERTEX_ATTRIB_FLAG_POS_COLOR_TEX );

    glBindBuffer(GL_ARRAY_BUFFER, 0);
    glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_POSITION);
    glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 2, GL_FLOAT, GL_FALSE, 0, hillTopVertices);
    glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_TEX_COORD, 2, GL_FLOAT, GL_FALSE, 0, hillTopTexCoords);
    glDrawArrays(GL_TRIANGLE_STRIP, 0, (GLsizei)MAX_COORDINATES);


    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);

}
分类: stackoverflow精选, unity3d 标签:

Duplicated Animations between prefabs

2015年3月11日 没有评论

I got two and more instances of the same prefab in a scene.
Every one of them has an animator, and every one of them has the same
animator controller connected to it.
When I animate one of them, all of them get the very same animation.
Any clues on what on earth is there happening? Should I have a separate
animator controller for every player on scene? How do I separate animators from each other in C#?

I will add this as an answer even though you didn’t put your code as a resources. This is just going to be my Bet.

I have made a game that also shares animator with the same prefabs but if you are calling just the GameObject that needs to animate. It should not call the other Animator calls An Object is Instantiated with different Animators each time, even if the file of the Animator is the same.

To Test this I would suggest that each time you instantiate your GameObject. name it something else. for example.

public GameObject[] myPrefabs; //make sure to add the size in the inspector

myPrefabs[0] = (GameObject)Instantiate(nameofPrefab);
myPrefabs[0].name = "myPrefabs0"; // this is to make sure that name (Clone) is removed;

// Then call the animation.
myPrefabs[0].GetComponent<Animator>().SetTrigger("Attack");

//SetTrigger, SetBool, SetInt. Since it is an Animator

I use List instead of Array, but I think this is the most basic one that I can give.

The naming of the prefab is not necessary to fix your problem. But you need it so you can check if it is the correct GameObject that is taking your Animator Call

No, you can use an animator controller for several prefabs. I don’t know what did you try, what is your mistake. if you put your code I can help more.

All of your prefabs must have its own Animator components. Then, this objects can use same animator controller.

For example,

Animator animator;

GameObject prefab;
List<GameObject> prefabs;

prefab = (GameObject)Instantiate(Resources.Load("prefabNameinAssets"));
prefab.AddComponent<Animator>(); // add each prefab its own Animator component

animator = prefab.GetComponent<Animator>();
animator.runtimeAnimatorController = (RuntimeAnimatorController)Instantiate(Resources.Load("animatorControllerNameinAssets"));
//get prefab's Animator Component and set its controller

prefab.name = "prefabName";
prefabs.Add(prefab);

After that you can use all prefabs animator controller separately. It will not affect other prefabs AnimatorControllers.

prefabs[0].GetComponent<Animator>().setTrigger("Animation");
分类: stackoverflow精选, unity3d 标签: