Remove transform from playercontroller

This commit is contained in:
Denis-Cosmin Nutiu 2019-06-02 17:40:06 +03:00
parent bb74be08de
commit f5e7e78323
2 changed files with 6 additions and 12 deletions

View file

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: dab5da68831f44f63b7b6ba9f49a4d17
guid: 55804228f3fc40ad8c5e0992ea925b1c
folderAsset: yes
DefaultImporter:
externalObjects: {}

View file

@ -11,15 +11,10 @@ namespace src.Player
public GameObject bombPrefab;
Transform playerTransform;
//O sa fie mai tarziu folosita cand o sa avem numar de bombe allowed
bool canPlaceBombs = true;
protected new void Start()
{
base.Start();
/* Always start at the starting point. */
Respawn();
}
@ -49,7 +44,6 @@ namespace src.Player
var movementVector = new Vector2(horizontal, vertical);
Rigidbody2d.position += movementSpeed * Time.deltaTime * movementVector;
playerTransform.position = movementVector;
#elif UNITY_IOS || UNITY_ANDROID
// Phone movement is not supported yet.
#elif UNITY_PS4 || UNITY_XBOXONE
@ -59,15 +53,15 @@ namespace src.Player
private void PlaceBomb()
{
Instantiate(bombPrefab, new Vector3(Mathf.RoundToInt(playerTransform.position.x),
bombPrefab.transform.position.y, Mathf.RoundToInt(playerTransform.position.z)),
bombPrefab.transform.rotation);
Instantiate(bombPrefab, new Vector3(Mathf.RoundToInt(transform.position.x),
bombPrefab.transform.position.y, 0f),
bombPrefab.transform.rotation);
}
private void HandleBomb()
{
#if UNITY_EDITOR || UNITY_STANDALONE || UNITY_WEBGL
if (canPlaceBombs && Input.GetKeyDown(KeyCode.Space))
if (Input.GetKeyDown(KeyCode.Space))
{
PlaceBomb();
}