Shooter in iOS and a visible Aim line before shooting
- by London2423
I have to questions.
I am trying to develop a game that is iOS but I did it first in my computer so I can tested there.
I was able to must of it for PC but I am having a very hard time with iOS port
The problem I do have is that I don't know how to shout in iOS. To be more specific how to line render in iOS
This is the script I use in my computer
using UnityEngine;
using System.Collections;
public class NewBehaviourScript : MonoBehaviour
{
LineRenderer line;
void Start ()
{
line = gameObject.GetComponent<LineRenderer>();
line.enabled = false;
}
void Update ()
{
if (Input.GetButtonDown ("Fire1"))
{
StopCoroutine ("FireLaser");
StartCoroutine ("FireLaser");
}
}
IEnumerator FireLaser ()
{
line.enabled = true;
while (Input.GetButton("Fire1"))
{
Ray ray = new Ray(transform.position, transform.forward);
RaycastHit hit;
line.SetPosition (0, ray.origin);
if (Physics.Raycast (ray, out hit,100))
{
line.SetPosition(1,hit.point);
if (hit.rigidbody)
{
hit.rigidbody.AddForceAtPosition(transform.forward * 5, hit.point);
}
}
else
line.SetPosition (1, ray.GetPoint (100));
yield return null;
}
line.enabled = false;
{
}
}
}
Which part I have to change for iOS?
I already did in the iOS the touch giu event so my player move around in the xcode/Iphone but I need some help with the shouting part.
The second part of the question is where I do have to insert or change the script in order to first aim and I DO see the line of aim and then shout.
Now the player can only shout. It can not aim at the gameobject, see the the line coming out of the gun aiming at the object and then shout?
How I can do that. Everyone tell me Line render but that's what i did
Thank you