For this project, we had to make a 3d puzzler, where with the use of one main mechanic you can solve the puzzles. In the end, we came up with the plan to make the mechanic time travel. If you time travel, you go to a different season so the player will stay in the same position, but the look will be different. Every season can have items that you can pick up and take to a different season to use there. Also, some obstacles and passageways can only be used in a pacific time.
In this project, I did a few things. I started out making the player movement. First I worked with the new input system. I have also worked on making the time travel system. I have done this by having the world on a set offset. And every time you press the button the player gets moved between these worlds. I had made this system able to work with any amount of world. But in the end, we only used two worlds.
DATE | ENGINE | PROGRAMMERS | ARTIST |
---|---|---|---|
April 19nd | Unity | Sjoerd | Bas |
3 weeks | Onne | Dailyn |
This code was made of the time warp system. It works by placing the different time's worlds a set distance away. Then every time the player warps I record the player's position compared to its current world. I do this by parenting the player to the world. And then get its local position. after that I give the player a new parent of the new world and give its local position back.
private void Start()
{
for (int i = 0; i < timeWarpWorlds.Count; i++)
{
timeWarpWorlds[i].transform.position += levelOffset * i;
}
}
///
/// Will change the parent object to the world you want the player to move to
/// and than will set its localPosition to there
///
/// the season you want to travel to
public async void TimeWarp(GameObject timeWarpWorld)
{
// can not move the player object wen the player is active
player.enabled = false;
Vector3 playerToLevel = player.transform.localPosition;
player.transform.SetParent(timeWarpWorld.transform);
// waits for the time warp animation to finish before moving over the player
beforeTImeWarp.Invoke();
await Task.Delay(TimeSpan.FromSeconds(warpTimeDelay));
onTimeWarp.Invoke();
player.transform.localPosition = playerToLevel;
player.enabled = true;
}
For the Winter season, I made this snow shader with the shader graph. It's a vertex shader with some random noise. For the player trails, I used a rendertexter that picks up particles that spawn under the player.