Skip to content

Commit

Permalink
Fixed #15 Tank are now more than twice bigger, Replaced map hitboxes
Browse files Browse the repository at this point in the history
  • Loading branch information
Stolous committed May 14, 2017
1 parent b9129db commit df2630d
Show file tree
Hide file tree
Showing 8 changed files with 5 additions and 3 deletions.
Binary file modified Assets/Prefabs/Missile.prefab
Binary file not shown.
Binary file modified Assets/Prefabs/Player.prefab
Binary file not shown.
Binary file modified Assets/Scenes/Game.unity
Binary file not shown.
8 changes: 5 additions & 3 deletions Assets/Scripts/Player/TankMovements.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace TankFighters.Player
[RequireComponent (typeof(CharacterController))]
public class TankMovements : NetworkBehaviour
{
public int speed = 1;
public float speed = 1f;
public Transform headTransform;
public Transform missileSpawn;

Expand Down Expand Up @@ -56,14 +56,16 @@ void Update()
movement *= Time.deltaTime;
controller.Move(movement);

int layerMask = 1 << LayerMask.NameToLayer("Ground");

#if !UNITY_EDITOR
for (var i = 0; i < Input.touchCount; ++i)
{
if (Input.GetTouch(i).phase == TouchPhase.Began)
{
ray = Camera.main.ScreenPointToRay((Vector3)Input.GetTouch(i).position);
RaycastHit hit;
if(canFire && tank.health > 0 && Physics.Raycast(ray, out hit, LayerMask.NameToLayer("Ground")) && !EventSystem.current.IsPointerOverGameObject(Input.GetTouch(i).fingerId))
if(canFire && tank.health > 0 && Physics.Raycast(ray, out hit, 100f, LayerMask) && !EventSystem.current.IsPointerOverGameObject(Input.GetTouch(i).fingerId))
{
headTransform.LookAt(new Vector3(hit.point.x, headTransform.position.y, hit.point.z));
CmdSpawnMissile(missileSpawn.position);
Expand All @@ -76,7 +78,7 @@ void Update()
{
ray = Camera.main.ScreenPointToRay(Input.mousePosition + new Vector3(0f, 0f, 10f));
RaycastHit hit;
if(canFire && tank.health > 0 && Physics.Raycast(ray, out hit, LayerMask.NameToLayer("Ground")))
if(canFire && tank.health > 0 && Physics.Raycast(ray, out hit, 10000f, layerMask))
{
headTransform.LookAt(new Vector3(hit.point.x, headTransform.position.y, hit.point.z));
CmdSpawnMissile(missileSpawn.position);
Expand Down
Binary file modified ProjectSettings/DynamicsManager.asset
Binary file not shown.
Binary file modified ProjectSettings/GraphicsSettings.asset
Binary file not shown.
Binary file modified ProjectSettings/ProjectSettings.asset
Binary file not shown.
Binary file modified ProjectSettings/TagManager.asset
Binary file not shown.

0 comments on commit df2630d

Please sign in to comment.