EgeStrqfes
Hectopat
- Katılım
- 30 Ocak 2021
- Mesajlar
- 898
- Çözümler
- 3
Daha fazla
- Cinsiyet
- Erkek
Merhaba, Unity'de oyun yapıyorum bu sorun ile karşılaştım hata tam olarak nerede?
Bu da error;
Assets\Script\Player.cs(39,17): error CS0029: Cannot implicitly convert type 'unityengine. Touchphase' to 'bool'.
C#:
//transform.position topun pozisyonu | deltaPosition aradaki farkı alan. | speedModifier int ile çarpıyor.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Player : MonoBehaviour.
{
public GameObject cam;
private Rigidbody rb;
private Touch touch;
[Range(20,40)]
public int speedModifier;
public int forwardSpeed;
public void Start()
{
rb = GetComponent<Rigidbody>();
}
public void Update()
{
if (Variables.firsttouch == 1)
{
transform.position += new Vector3(0,0, forwardSpeed * Time.deltaTime);
}
if (Input.touchCount > 0)
{
touch = Input.GetTouch(0);
if (touch.phase = TouchPhase.Began)
{
Variables.firsttouch = 1;
}
else if (touch.phase == TouchPhase.Moved)
{
rb.velocity = new Vector3(touch.deltaPosition.x * speedModifier * Time.deltaTime,
transform.position.y,
touch.deltaPosition.y * speedModifier * Time.deltaTime);
}
else if(touch.phase == TouchPhase.Ended)
{
//rb.velocity = new Vector3(0, 0, 0);
rb.velocity = Vector3.zero;
}
}
}
}
Bu da error;
Assets\Script\Player.cs(39,17): error CS0029: Cannot implicitly convert type 'unityengine. Touchphase' to 'bool'.