示例#1
0
    private void crunchComponent()
    {
        // resize the game object, it also affects the chipmunk shape
        transform.localScale -= CRUNCH_VECTOR * CRUNCH_PROPORTION;
        // transform the body downwards
        float   centerOffsetY = ((1f - CRUNCH_PROPORTION) * 0.5f) * sizeY;
        Vector3 thePos        = transform.position;

        thePos.y          -= centerOffsetY * (1f + CRUNCH_PROPORTION);
        transform.position = thePos;
        body._UpdatedTransform();
    }
示例#2
0
    public void onReloadLevel(Vector3 spawnPos)
    {
        GameObjectTools.setActive(gameObject, true);

        chase.stop();

        transform.position = spawnPos;
        body._UpdatedTransform();         // update the body position
    }
示例#3
0
    public void onReloadLevel(Vector3 spawnPos)
    {
        GameObjectTools.setActive(gameObject, true);

        patrol.enablePatrol();
        patrol.setDir(1f);         // initialize patrol direction
        idle.setIdle(false);

        transform.position = spawnPos;
        body._UpdatedTransform();         // update the body position
    }
示例#4
0
 public void locateAt(Vector2 pos)
 {
     transform.position = pos;
     body._UpdatedTransform();         // update the body position
 }