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(); }
public void onReloadLevel(Vector3 spawnPos) { GameObjectTools.setActive(gameObject, true); chase.stop(); transform.position = spawnPos; body._UpdatedTransform(); // update the body position }
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 }
public void locateAt(Vector2 pos) { transform.position = pos; body._UpdatedTransform(); // update the body position }