Update changes to scripts and AudioSystem #224
|
@ -13,6 +13,7 @@
|
||||||
Near: 0.00999999978
|
Near: 0.00999999978
|
||||||
Far: 10000
|
Far: 10000
|
||||||
Perspective: true
|
Perspective: true
|
||||||
|
IsActive: true
|
||||||
Light Component:
|
Light Component:
|
||||||
Position: {x: 0, y: 0, z: 0}
|
Position: {x: 0, y: 0, z: 0}
|
||||||
Type: Directional
|
Type: Directional
|
||||||
|
@ -20,6 +21,7 @@
|
||||||
Color: {x: 0.951541841, y: 0.921719015, z: 0.553319454, w: 1}
|
Color: {x: 0.951541841, y: 0.921719015, z: 0.553319454, w: 1}
|
||||||
Layer: 4294967295
|
Layer: 4294967295
|
||||||
Strength: 0
|
Strength: 0
|
||||||
|
IsActive: true
|
||||||
Scripts: ~
|
Scripts: ~
|
||||||
- EID: 1
|
- EID: 1
|
||||||
Name: Default
|
Name: Default
|
||||||
|
@ -30,9 +32,11 @@
|
||||||
Translate: {x: -1.440328, y: -4.41369677, z: -5}
|
Translate: {x: -1.440328, y: -4.41369677, z: -5}
|
||||||
Rotate: {x: -0, y: 0, z: -0}
|
Rotate: {x: -0, y: 0, z: -0}
|
||||||
Scale: {x: 49.4798889, y: 0.5, z: 17.5}
|
Scale: {x: 49.4798889, y: 0.5, z: 17.5}
|
||||||
|
IsActive: true
|
||||||
Renderable Component:
|
Renderable Component:
|
||||||
Mesh: 149697411
|
Mesh: 149697411
|
||||||
Material: 126974645
|
Material: 126974645
|
||||||
|
IsActive: true
|
||||||
RigidBody Component:
|
RigidBody Component:
|
||||||
Type: Static
|
Type: Static
|
||||||
Mass: 1
|
Mass: 1
|
||||||
|
@ -46,6 +50,7 @@
|
||||||
Freeze Rotation X: false
|
Freeze Rotation X: false
|
||||||
Freeze Rotation Y: false
|
Freeze Rotation Y: false
|
||||||
Freeze Rotation Z: false
|
Freeze Rotation Z: false
|
||||||
|
IsActive: true
|
||||||
Collider Component:
|
Collider Component:
|
||||||
Colliders:
|
Colliders:
|
||||||
- Is Trigger: false
|
- Is Trigger: false
|
||||||
|
@ -55,6 +60,7 @@
|
||||||
Bounciness: 0
|
Bounciness: 0
|
||||||
Density: 1
|
Density: 1
|
||||||
Position Offset: {x: 0, y: 0, z: 0}
|
Position Offset: {x: 0, y: 0, z: 0}
|
||||||
|
IsActive: true
|
||||||
Scripts: ~
|
Scripts: ~
|
||||||
- EID: 2
|
- EID: 2
|
||||||
Name: Player
|
Name: Player
|
||||||
|
@ -62,12 +68,14 @@
|
||||||
NumberOfChildren: 3
|
NumberOfChildren: 3
|
||||||
Components:
|
Components:
|
||||||
Transform Component:
|
Transform Component:
|
||||||
Translate: {x: -0.867276311, y: -3.67369723, z: -9.76580334}
|
Translate: {x: -17.1017113, y: -3.67369723, z: -6.04142666}
|
||||||
Rotate: {x: -0, y: 0, z: 0}
|
Rotate: {x: -0, y: 0, z: 0}
|
||||||
Scale: {x: 2, y: 2, z: 2}
|
Scale: {x: 2, y: 2, z: 2}
|
||||||
|
IsActive: true
|
||||||
Renderable Component:
|
Renderable Component:
|
||||||
Mesh: 149697411
|
Mesh: 149697411
|
||||||
Material: 126974645
|
Material: 126974645
|
||||||
|
IsActive: true
|
||||||
RigidBody Component:
|
RigidBody Component:
|
||||||
Type: Dynamic
|
Type: Dynamic
|
||||||
Mass: 1
|
Mass: 1
|
||||||
|
@ -81,6 +89,7 @@
|
||||||
Freeze Rotation X: true
|
Freeze Rotation X: true
|
||||||
Freeze Rotation Y: true
|
Freeze Rotation Y: true
|
||||||
Freeze Rotation Z: true
|
Freeze Rotation Z: true
|
||||||
|
IsActive: true
|
||||||
Collider Component:
|
Collider Component:
|
||||||
Colliders:
|
Colliders:
|
||||||
- Is Trigger: false
|
- Is Trigger: false
|
||||||
|
@ -90,12 +99,13 @@
|
||||||
Bounciness: 0
|
Bounciness: 0
|
||||||
Density: 1
|
Density: 1
|
||||||
Position Offset: {x: 0, y: 0.5, z: 0}
|
Position Offset: {x: 0, y: 0.5, z: 0}
|
||||||
|
IsActive: true
|
||||||
Scripts:
|
Scripts:
|
||||||
- Type: PlayerController
|
- Type: PlayerController
|
||||||
currentState: 0
|
currentState: 0
|
||||||
maxMoveVel: 2
|
maxMoveVel: 4
|
||||||
moveForce: 50
|
moveForce: 50
|
||||||
sprintMultiplier: 2
|
sprintMultiplier: 1.5
|
||||||
rotationFactorPerFrame: 1
|
rotationFactorPerFrame: 1
|
||||||
maxJumpHeight: 4
|
maxJumpHeight: 4
|
||||||
maxJumpTime: 0.75
|
maxJumpTime: 0.75
|
||||||
|
@ -104,17 +114,18 @@
|
||||||
mediumMultiper: 0.5
|
mediumMultiper: 0.5
|
||||||
heavyMultiper: 0.25
|
heavyMultiper: 0.25
|
||||||
- Type: PickAndThrow
|
- Type: PickAndThrow
|
||||||
holdPosition: [0, 1, 0]
|
holdPosition: [0, 1.20000005, 0]
|
||||||
throwForce: [100, 200, 100]
|
throwForce: [200, 300, 200]
|
||||||
- EID: 3
|
- EID: 3
|
||||||
Name: Default
|
Name: Default
|
||||||
IsActive: true
|
IsActive: true
|
||||||
NumberOfChildren: 0
|
NumberOfChildren: 0
|
||||||
Components:
|
Components:
|
||||||
Transform Component:
|
Transform Component:
|
||||||
Translate: {x: 0, y: 1, z: 0}
|
Translate: {x: 0, y: 1.20000005, z: 0}
|
||||||
Rotate: {x: -0, y: 0, z: -0}
|
Rotate: {x: -0, y: 0, z: -0}
|
||||||
Scale: {x: 1, y: 1, z: 1}
|
Scale: {x: 1, y: 1, z: 1}
|
||||||
|
IsActive: true
|
||||||
Scripts: ~
|
Scripts: ~
|
||||||
- EID: 4
|
- EID: 4
|
||||||
Name: Default
|
Name: Default
|
||||||
|
@ -123,18 +134,20 @@
|
||||||
Components:
|
Components:
|
||||||
Transform Component:
|
Transform Component:
|
||||||
Translate: {x: 0, y: 0, z: 0}
|
Translate: {x: 0, y: 0, z: 0}
|
||||||
Rotate: {x: -0.549778998, y: 1.59691703, z: 0}
|
Rotate: {x: -0.78538686, y: 1.26529622, z: 0}
|
||||||
Scale: {x: 1, y: 1, z: 1}
|
Scale: {x: 1, y: 1, z: 1}
|
||||||
|
IsActive: true
|
||||||
Camera Component:
|
Camera Component:
|
||||||
Position: {x: -0.867276311, y: -3.67369723, z: -9.76580334}
|
Position: {x: -17.1017113, y: -3.67369723, z: -6.04142666}
|
||||||
Pitch: -31.5000153
|
Pitch: -44.9993515
|
||||||
Yaw: 91.4966049
|
Yaw: 72.4961319
|
||||||
Roll: 0
|
Roll: 0
|
||||||
Width: 1920
|
Width: 1920
|
||||||
Height: 1080
|
Height: 1080
|
||||||
Near: 0.00999999978
|
Near: 0.00999999978
|
||||||
Far: 10000
|
Far: 10000
|
||||||
Perspective: true
|
Perspective: true
|
||||||
|
IsActive: true
|
||||||
Scripts:
|
Scripts:
|
||||||
- Type: SHADE_Scripting.ThirdPersonCamera
|
- Type: SHADE_Scripting.ThirdPersonCamera
|
||||||
armLength: 2
|
armLength: 2
|
||||||
|
@ -150,9 +163,11 @@
|
||||||
Translate: {x: 0, y: 0, z: 0}
|
Translate: {x: 0, y: 0, z: 0}
|
||||||
Rotate: {x: 0, y: 0, z: 0}
|
Rotate: {x: 0, y: 0, z: 0}
|
||||||
Scale: {x: 1, y: 1, z: 1}
|
Scale: {x: 1, y: 1, z: 1}
|
||||||
|
IsActive: true
|
||||||
Renderable Component:
|
Renderable Component:
|
||||||
Mesh: 144838771
|
Mesh: 144838771
|
||||||
Material: 123745521
|
Material: 123745521
|
||||||
|
IsActive: true
|
||||||
Scripts: ~
|
Scripts: ~
|
||||||
- EID: 6
|
- EID: 6
|
||||||
Name: AI
|
Name: AI
|
||||||
|
@ -163,9 +178,11 @@
|
||||||
Translate: {x: -8, y: -4.42369843, z: 2.5}
|
Translate: {x: -8, y: -4.42369843, z: 2.5}
|
||||||
Rotate: {x: -0, y: 0, z: 0}
|
Rotate: {x: -0, y: 0, z: 0}
|
||||||
Scale: {x: 1, y: 1, z: 1}
|
Scale: {x: 1, y: 1, z: 1}
|
||||||
|
IsActive: true
|
||||||
Renderable Component:
|
Renderable Component:
|
||||||
Mesh: 149697411
|
Mesh: 149697411
|
||||||
Material: 126974645
|
Material: 126974645
|
||||||
|
IsActive: true
|
||||||
RigidBody Component:
|
RigidBody Component:
|
||||||
Type: Dynamic
|
Type: Dynamic
|
||||||
Mass: 1
|
Mass: 1
|
||||||
|
@ -179,6 +196,7 @@
|
||||||
Freeze Rotation X: true
|
Freeze Rotation X: true
|
||||||
Freeze Rotation Y: true
|
Freeze Rotation Y: true
|
||||||
Freeze Rotation Z: true
|
Freeze Rotation Z: true
|
||||||
|
IsActive: true
|
||||||
Collider Component:
|
Collider Component:
|
||||||
Colliders:
|
Colliders:
|
||||||
- Is Trigger: false
|
- Is Trigger: false
|
||||||
|
@ -188,6 +206,7 @@
|
||||||
Bounciness: 0
|
Bounciness: 0
|
||||||
Density: 1
|
Density: 1
|
||||||
Position Offset: {x: 0, y: 0.5, z: 0}
|
Position Offset: {x: 0, y: 0.5, z: 0}
|
||||||
|
IsActive: true
|
||||||
Scripts: ~
|
Scripts: ~
|
||||||
- EID: 7
|
- EID: 7
|
||||||
Name: Default
|
Name: Default
|
||||||
|
@ -198,9 +217,11 @@
|
||||||
Translate: {x: 0, y: -16.8647861, z: -14.039052}
|
Translate: {x: 0, y: -16.8647861, z: -14.039052}
|
||||||
Rotate: {x: -0, y: 0, z: -0}
|
Rotate: {x: -0, y: 0, z: -0}
|
||||||
Scale: {x: 28.1434975, y: 28.1434975, z: 28.1434975}
|
Scale: {x: 28.1434975, y: 28.1434975, z: 28.1434975}
|
||||||
|
IsActive: true
|
||||||
Renderable Component:
|
Renderable Component:
|
||||||
Mesh: 149697411
|
Mesh: 149697411
|
||||||
Material: 126974645
|
Material: 126974645
|
||||||
|
IsActive: true
|
||||||
Scripts: ~
|
Scripts: ~
|
||||||
- EID: 8
|
- EID: 8
|
||||||
Name: Default
|
Name: Default
|
||||||
|
@ -214,8 +235,54 @@
|
||||||
Color: {x: 1, y: 1, z: 1, w: 1}
|
Color: {x: 1, y: 1, z: 1, w: 1}
|
||||||
Layer: 4294967295
|
Layer: 4294967295
|
||||||
Strength: 0.25
|
Strength: 0.25
|
||||||
|
IsActive: true
|
||||||
Scripts: ~
|
Scripts: ~
|
||||||
- EID: 5
|
- EID: 11
|
||||||
|
Name: GameManager
|
||||||
|
IsActive: true
|
||||||
|
NumberOfChildren: 0
|
||||||
|
Components:
|
||||||
|
Transform Component:
|
||||||
|
Translate: {x: 0, y: 0, z: 0}
|
||||||
|
Rotate: {x: 0, y: 0, z: 0}
|
||||||
|
Scale: {x: 1, y: 1, z: 1}
|
||||||
|
IsActive: true
|
||||||
|
RigidBody Component:
|
||||||
|
Type: Static
|
||||||
|
Mass: 1
|
||||||
|
Drag: 0.00999999978
|
||||||
|
Angular Drag: 0.00999999978
|
||||||
|
Use Gravity: true
|
||||||
|
Interpolate: true
|
||||||
|
Freeze Position X: false
|
||||||
|
Freeze Position Y: false
|
||||||
|
Freeze Position Z: false
|
||||||
|
Freeze Rotation X: false
|
||||||
|
Freeze Rotation Y: false
|
||||||
|
Freeze Rotation Z: false
|
||||||
|
IsActive: true
|
||||||
|
Collider Component:
|
||||||
|
Colliders:
|
||||||
|
- Is Trigger: true
|
||||||
|
Type: Box
|
||||||
|
Half Extents: {x: 3.5999999, y: 8, z: 7.19999981}
|
||||||
|
Friction: 0.400000006
|
||||||
|
Bounciness: 0
|
||||||
|
Density: 1
|
||||||
|
Position Offset: {x: -24.3999996, y: -3.0999999, z: -5.0999999}
|
||||||
|
IsActive: true
|
||||||
|
Scripts:
|
||||||
|
- Type: GameManager
|
||||||
|
itemPool: 12
|
||||||
|
totalItemCount: 0
|
||||||
|
Score: 1
|
||||||
|
- EID: 12
|
||||||
|
Name: ItemPool
|
||||||
|
IsActive: true
|
||||||
|
NumberOfChildren: 2
|
||||||
|
Components: ~
|
||||||
|
Scripts: ~
|
||||||
|
- EID: 10
|
||||||
Name: item
|
Name: item
|
||||||
IsActive: true
|
IsActive: true
|
||||||
NumberOfChildren: 0
|
NumberOfChildren: 0
|
||||||
|
@ -224,9 +291,11 @@
|
||||||
Translate: {x: 3.19870043, y: -3.67369723, z: -5}
|
Translate: {x: 3.19870043, y: -3.67369723, z: -5}
|
||||||
Rotate: {x: -0, y: 0, z: 0}
|
Rotate: {x: -0, y: 0, z: 0}
|
||||||
Scale: {x: 2, y: 2, z: 2}
|
Scale: {x: 2, y: 2, z: 2}
|
||||||
|
IsActive: true
|
||||||
Renderable Component:
|
Renderable Component:
|
||||||
Mesh: 144838771
|
Mesh: 144838771
|
||||||
Material: 123745521
|
Material: 123745521
|
||||||
|
IsActive: true
|
||||||
RigidBody Component:
|
RigidBody Component:
|
||||||
Type: Dynamic
|
Type: Dynamic
|
||||||
Mass: 1
|
Mass: 1
|
||||||
|
@ -240,6 +309,7 @@
|
||||||
Freeze Rotation X: true
|
Freeze Rotation X: true
|
||||||
Freeze Rotation Y: true
|
Freeze Rotation Y: true
|
||||||
Freeze Rotation Z: true
|
Freeze Rotation Z: true
|
||||||
|
IsActive: true
|
||||||
Collider Component:
|
Collider Component:
|
||||||
Colliders:
|
Colliders:
|
||||||
- Is Trigger: false
|
- Is Trigger: false
|
||||||
|
@ -256,6 +326,56 @@
|
||||||
Bounciness: 0
|
Bounciness: 0
|
||||||
Density: 1
|
Density: 1
|
||||||
Position Offset: {x: 0, y: 0.5, z: 0}
|
Position Offset: {x: 0, y: 0.5, z: 0}
|
||||||
|
IsActive: true
|
||||||
|
Scripts:
|
||||||
|
- Type: Item
|
||||||
|
Score: 1
|
||||||
|
currCategory: 0
|
||||||
|
- EID: 5
|
||||||
|
Name: item
|
||||||
|
IsActive: true
|
||||||
|
NumberOfChildren: 0
|
||||||
|
Components:
|
||||||
|
Transform Component:
|
||||||
|
Translate: {x: -3.09096575, y: -2.43732405, z: -6.98679876}
|
||||||
|
Rotate: {x: -0, y: 0, z: -0}
|
||||||
|
Scale: {x: 2, y: 2, z: 2}
|
||||||
|
IsActive: true
|
||||||
|
Renderable Component:
|
||||||
|
Mesh: 144838771
|
||||||
|
Material: 123745521
|
||||||
|
IsActive: true
|
||||||
|
RigidBody Component:
|
||||||
|
Type: Dynamic
|
||||||
|
Mass: 1
|
||||||
|
Drag: 0
|
||||||
|
Angular Drag: 0
|
||||||
|
Use Gravity: true
|
||||||
|
Interpolate: false
|
||||||
|
Freeze Position X: false
|
||||||
|
Freeze Position Y: false
|
||||||
|
Freeze Position Z: false
|
||||||
|
Freeze Rotation X: true
|
||||||
|
Freeze Rotation Y: true
|
||||||
|
Freeze Rotation Z: true
|
||||||
|
IsActive: true
|
||||||
|
Collider Component:
|
||||||
|
Colliders:
|
||||||
|
- Is Trigger: false
|
||||||
|
Type: Box
|
||||||
|
Half Extents: {x: 1, y: 1, z: 1}
|
||||||
|
Friction: 0.400000006
|
||||||
|
Bounciness: 0
|
||||||
|
Density: 1
|
||||||
|
Position Offset: {x: 0, y: 0.5, z: 0}
|
||||||
|
- Is Trigger: true
|
||||||
|
Type: Box
|
||||||
|
Half Extents: {x: 2, y: 2, z: 2}
|
||||||
|
Friction: 0.400000006
|
||||||
|
Bounciness: 0
|
||||||
|
Density: 1
|
||||||
|
Position Offset: {x: 0, y: 0.5, z: 0}
|
||||||
|
IsActive: true
|
||||||
Scripts:
|
Scripts:
|
||||||
- Type: Item
|
- Type: Item
|
||||||
Score: 1
|
Score: 1
|
||||||
|
|
|
@ -0,0 +1,43 @@
|
||||||
|
using SHADE;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
public class GameManager : Script
|
||||||
|
{
|
||||||
|
enum GameState
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public GameObject itemPool;
|
||||||
|
public int totalItemCount;
|
||||||
|
public int Score;
|
||||||
|
private IEnumerable<Item> listOfItems;
|
||||||
|
|
||||||
|
protected override void awake()
|
||||||
|
{
|
||||||
|
totalItemCount = 0;
|
||||||
|
Score = 0;
|
||||||
|
|
||||||
|
if (itemPool)
|
||||||
|
{
|
||||||
|
listOfItems = itemPool.GetScriptsInChildren<Item>();
|
||||||
|
foreach (Item i in listOfItems)
|
||||||
|
totalItemCount += 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void update()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void onTriggerEnter(CollisionInfo info)
|
||||||
|
{
|
||||||
|
if (info.GameObject.GetScript<Item>())
|
||||||
|
{
|
||||||
|
totalItemCount -= 1;
|
||||||
|
Score = info.GameObject.GetScript<Item>().Score;
|
||||||
|
info.GameObject.SetActive(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
Name: SC_GameManager
|
||||||
|
ID: 161629605
|
||||||
|
Type: 9
|
|
@ -8,7 +8,7 @@ public class Item : Script
|
||||||
MEDIUM,
|
MEDIUM,
|
||||||
HEAVY
|
HEAVY
|
||||||
}
|
}
|
||||||
public int Score = 1;
|
public int Score = 10;
|
||||||
|
|
||||||
public ItemCategory currCategory;
|
public ItemCategory currCategory;
|
||||||
|
|
||||||
|
|
|
@ -97,7 +97,6 @@ public class PickAndThrow : Script
|
||||||
}
|
}
|
||||||
protected override void onTriggerEnter(CollisionInfo info)
|
protected override void onTriggerEnter(CollisionInfo info)
|
||||||
{
|
{
|
||||||
//Debug.Log("ENTER");
|
|
||||||
if (info.GameObject.GetScript<Item>() != null && !pc.holdItem)
|
if (info.GameObject.GetScript<Item>() != null && !pc.holdItem)
|
||||||
{
|
{
|
||||||
item = info.GameObject;
|
item = info.GameObject;
|
||||||
|
|
|
@ -97,9 +97,6 @@ public class PlayerController : Script
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
rb.IsGravityEnabled = false;
|
rb.IsGravityEnabled = false;
|
||||||
rb.FreezeRotationX = true;
|
|
||||||
rb.FreezeRotationY = true;
|
|
||||||
rb.FreezeRotationZ = true;
|
|
||||||
rb.Interpolating = false;
|
rb.Interpolating = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,24 +140,18 @@ public class PlayerController : Script
|
||||||
Sprint();
|
Sprint();
|
||||||
Jump();
|
Jump();
|
||||||
Gravity();
|
Gravity();
|
||||||
//Debug.Log($"X: {rb.LinearVelocity.x}" + $" z: {rb.LinearVelocity.z}");
|
//Debug.Log($"X: {rb.LinearVelocity.x}" + $" Z: {rb.LinearVelocity.z}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void MoveKey()
|
private void MoveKey()
|
||||||
{
|
{
|
||||||
|
|
||||||
xAxisMove = 0;
|
|
||||||
zAxisMove = 0;
|
|
||||||
axisMove = Vector2.Zero;
|
axisMove = Vector2.Zero;
|
||||||
if (Input.GetKey(Input.KeyCode.W))
|
if (Input.GetKey(Input.KeyCode.W))
|
||||||
{
|
{
|
||||||
Vector3 camerAixs = cam.GetForward();
|
Vector3 camerAixs = cam.GetForward();
|
||||||
camerAixs.y = 0;
|
camerAixs.y = 0;
|
||||||
camerAixs.Normalise();
|
camerAixs.Normalise();
|
||||||
xAxisMove = camerAixs.x;
|
|
||||||
zAxisMove = camerAixs.z;
|
|
||||||
|
|
||||||
axisMove += new Vector2(camerAixs.x, camerAixs.z);
|
axisMove += new Vector2(camerAixs.x, camerAixs.z);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -169,8 +160,6 @@ public class PlayerController : Script
|
||||||
Vector3 camerAixs = cam.GetForward();
|
Vector3 camerAixs = cam.GetForward();
|
||||||
camerAixs.y = 0;
|
camerAixs.y = 0;
|
||||||
camerAixs.Normalise();
|
camerAixs.Normalise();
|
||||||
xAxisMove = -camerAixs.x;
|
|
||||||
zAxisMove = -camerAixs.z;
|
|
||||||
axisMove -= new Vector2(camerAixs.x, camerAixs.z);
|
axisMove -= new Vector2(camerAixs.x, camerAixs.z);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -179,8 +168,6 @@ public class PlayerController : Script
|
||||||
Vector3 camerAixs = cam.GetRight();
|
Vector3 camerAixs = cam.GetRight();
|
||||||
camerAixs.y = 0;
|
camerAixs.y = 0;
|
||||||
camerAixs.Normalise();
|
camerAixs.Normalise();
|
||||||
xAxisMove = -camerAixs.x;
|
|
||||||
zAxisMove = -camerAixs.z;
|
|
||||||
axisMove -= new Vector2(camerAixs.x, camerAixs.z);
|
axisMove -= new Vector2(camerAixs.x, camerAixs.z);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -189,13 +176,11 @@ public class PlayerController : Script
|
||||||
Vector3 camerAixs = cam.GetRight();
|
Vector3 camerAixs = cam.GetRight();
|
||||||
camerAixs.y = 0;
|
camerAixs.y = 0;
|
||||||
camerAixs.Normalise();
|
camerAixs.Normalise();
|
||||||
xAxisMove = camerAixs.x;
|
|
||||||
zAxisMove = camerAixs.z;
|
|
||||||
axisMove += new Vector2(camerAixs.x, camerAixs.z);
|
axisMove += new Vector2(camerAixs.x, camerAixs.z);
|
||||||
}
|
}
|
||||||
|
|
||||||
axisMove.Normalise();
|
axisMove.Normalise();
|
||||||
isMoveKeyPress = xAxisMove != 0 || zAxisMove != 0;
|
isMoveKeyPress = axisMove.x != 0 || axisMove.y != 0;
|
||||||
|
|
||||||
if (isMoveKeyPress && isGrounded && !Input.GetKey(Input.KeyCode.LeftShift))
|
if (isMoveKeyPress && isGrounded && !Input.GetKey(Input.KeyCode.LeftShift))
|
||||||
{
|
{
|
||||||
|
@ -218,7 +203,6 @@ public class PlayerController : Script
|
||||||
{
|
{
|
||||||
if (rb != null)
|
if (rb != null)
|
||||||
{
|
{
|
||||||
//rb.AddForce(new Vector3(axisMove.x, 0.0f,axisMove.y) * moveForce);
|
|
||||||
rb.LinearVelocity += new Vector3(axisMove.x * moveForce, 0.0f, axisMove.y * moveForce) * Time.DeltaTimeF;
|
rb.LinearVelocity += new Vector3(axisMove.x * moveForce, 0.0f, axisMove.y * moveForce) * Time.DeltaTimeF;
|
||||||
|
|
||||||
if (isMoveKeyPress)
|
if (isMoveKeyPress)
|
||||||
|
@ -305,9 +289,9 @@ public class PlayerController : Script
|
||||||
private void Rotation()
|
private void Rotation()
|
||||||
{
|
{
|
||||||
Vector3 poitionToLookAt;
|
Vector3 poitionToLookAt;
|
||||||
poitionToLookAt.x = xAxisMove;
|
poitionToLookAt.x = axisMove.x;
|
||||||
poitionToLookAt.y = 0.0f;
|
poitionToLookAt.y = 0.0f;
|
||||||
poitionToLookAt.z = zAxisMove;
|
poitionToLookAt.z = axisMove.y;
|
||||||
|
|
||||||
if (tranform != null)
|
if (tranform != null)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue