is coding for mobile touch scripts same for android as for ios apple?
so will this code work in ios apple iphones also or just android?
using UnityEngine;
using System.Collections;
public class Toucht : MonoBehaviour
{
public float upForce;
public float downForce;
public float forwardSpeed;
public bool isDead = false;
Animator anim;
bool flap = false;
void Start()
{
anim = GetComponent<Animator> ();
GetComponent<Rigidbody2D>().velocity = new Vector2 (forwardSpeed, 0);
}
void Update()
{
if (isDead)
return;
Touch myTouch = Input.GetTouch(0);
Touch[] myTouches = Input.touches;
for(int i = 0; i < Input.touchCount; i++)
flap = true;
}
void FixedUpdate()
{
if (flap)
{
flap = false;
anim.SetTrigger ("Flap");
GetComponent<Rigidbody2D> ().velocity = new Vector2 (GetComponent<Rigidbody2D> ().velocity.x, 0);
GetComponent<Rigidbody2D> ().AddForce (new Vector2 (0, upForce));
}
if (Input.GetKeyDown("t"))
{
GetComponent<Rigidbody2D>().velocity = new Vector2(GetComponent<Rigidbody2D>().velocity.x, 0);
GetComponent<Rigidbody2D> ().AddForce (new Vector2 (-0, downForce));
}
}
int hit = 0;
void OnCollisionEnter2D(Collision2D other)
{
if(other.gameObject.tag == "Wall")
{
hit++;
if(hit >= 25)
Destroy(gameObject);
}
if(other.gameObject.tag == "Wall")
{
GetComponent<AudioSource>().Play();
}
}
}