Added 3D player model, added better cam movement
This commit is contained in:
@@ -15,6 +15,10 @@ namespace Assets.Scripts.Player
|
||||
{
|
||||
public class PlayerGameObject : MonoBehaviour
|
||||
{
|
||||
public float speed = 5f;
|
||||
public GameObject[] leftHands;
|
||||
public GameObject[] rightHands;
|
||||
|
||||
UIHandler uihandler;
|
||||
AudioHandler audioHandler;
|
||||
WorldGenerator worldGenerator;
|
||||
@@ -22,10 +26,11 @@ namespace Assets.Scripts.Player
|
||||
int difficulty = 0;
|
||||
bool finishedGame = false;
|
||||
PlayerObject player;
|
||||
public float speed = 5f;
|
||||
DateTime now;
|
||||
int bobbingDirection = -1;
|
||||
|
||||
public bool isArmed;
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
@@ -46,12 +51,15 @@ namespace Assets.Scripts.Player
|
||||
{
|
||||
worldGenerator = GameObject.Find("WorldGenerator").GetComponent<WorldGenerator>();
|
||||
}
|
||||
generatePlayer();
|
||||
isArmed = true;
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
if(player == null){
|
||||
return;
|
||||
}
|
||||
if (player.getStat("Killcount").getAmount() == -1)
|
||||
{
|
||||
return;
|
||||
@@ -137,8 +145,11 @@ namespace Assets.Scripts.Player
|
||||
string playername = PlayerPrefs.GetString("playername");
|
||||
difficulty = PlayerPrefs.GetInt("difficulty");
|
||||
player = new PlayerObject(playername, race, role, difficulty);
|
||||
player.getClass().loadHandObjects();
|
||||
GetComponent<Animator>().SetBool("isArmed", true);
|
||||
}
|
||||
|
||||
//Generating player instance for stat preview during creation
|
||||
public void generatePlayer(BasicRace playerRace, BasicClass playerClass, string name, int difficulty)
|
||||
{
|
||||
player = new PlayerObject(name, playerRace, playerClass, difficulty);
|
||||
@@ -164,20 +175,6 @@ namespace Assets.Scripts.Player
|
||||
movement = camera.transform.TransformDirection(movement);
|
||||
movement.y = 0;
|
||||
gameObject.transform.Translate(movement * speed * Time.deltaTime);
|
||||
|
||||
if (input.z != 0)
|
||||
{
|
||||
if (camera.transform.localPosition.y >= 0.5)
|
||||
{
|
||||
bobbingDirection = -1;
|
||||
}
|
||||
else if (camera.transform.localPosition.y <= 0.3)
|
||||
{
|
||||
bobbingDirection = 1;
|
||||
}
|
||||
|
||||
camera.transform.Translate(new Vector3(0, bobbingDirection, 0) * Time.deltaTime / 2);
|
||||
}
|
||||
GameObject.Find("QuestLog").GetComponent<QuestLog>().updateQuests("explore", gameObject, 1);
|
||||
}
|
||||
|
||||
@@ -324,6 +321,8 @@ namespace Assets.Scripts.Player
|
||||
{
|
||||
player = new PlayerObject();
|
||||
player.loadPlayer(json);
|
||||
player.getClass().loadHandObjects();
|
||||
GetComponent<Animator>().SetBool("isArmed", true);
|
||||
}
|
||||
|
||||
public PlayerObject getPlayer()
|
||||
|
||||
Reference in New Issue
Block a user