Cthulhu is a RPG game, and implement with unity.
- Game type: RPG, 3D
- Platform: Unity3D
The Background story of this game is based on the The Call of Cthulhu, which is a short story by American writer H. P. Lovecraft.
Main character prototype based on Francis Wayland Thurston who is the a character in The Call of Cthulhu.
- Player movement Complete
- User interface Complete
- Environment
- making WindMill rotating Complete
- Enemy Path Finding Complete
- Fully Event Based Raycasting
Based on the code below in file SpinMe.cs :
float xDegreesPerFrame = Time.deltaTime / 60 * 360 * xRotationsPerMinute;
transform.RotateAround(transform.position, transform.right, xDegreesPerFrame);
float yDegreesPerFrame = Time.deltaTime / 60 * 360 * yRotationsPerMinute;
transform.RotateAround(transform.position, transform.up, yDegreesPerFrame);
float zDegreesPerFrame = Time.deltaTime / 60 * 360 * zRotationsPerMinute;
transform.RotateAround(transform.position, transform.forward, zDegreesPerFrame);
2. About Enemy Path finding
- Using Nevigation and PathFinding( AI tool ) in Unity to find walkable ground in the environment item.
- Add nav mesh agent and AI character control functions
- using the nav mesh agent and AI character control functions in Enemy.cs:
if(distanceToPlayer <= attackRadius)
{
aiCharacterControl.SetTarget(player.transform);
}
else
{
aiCharacterControl.SetTarget(transform);
}
The enemy will stop when player character run away.
3. Fully Event Based Raycasting
4. Player Path finding
- Using Nevigation and PathFinding( AI tool ) in Unity to find walkable ground in the environment item.
- using the nav mesh agent and AI character control functions in PlayerMovement.cs:
switch (layerHit)
{
case enemyLayerNumber:
// navigate to the enemy
GameObject enemy = raycastHit.collider.gameObject;
aiCharacterControl.SetTarget(enemy.transform);
break;
case walkableLayerNumber:
// navigate to point on the ground
walkTarget.transform.position = raycastHit.point;
aiCharacterControl.SetTarget(walkTarget.transform);
break;
default:
Debug.LogWarning("Don't know how to handle mouse click for player movement");
return;
}
- The player will find the enemy after click the target one: