//For tutorial



    void Start()
    {
        Debug.Log("plane pilot script added to:" + gameObject.name);
        _instance = this;

        windSource = GetComponent <AudioSource> ();
    }
    void OnTriggerClicked(object sender, ControllerInteractionEventArgs e)
    {
        Debug.Log("yay");

        GameObject s     = Instantiate(seed, transform.position, Quaternion.identity);
        Rigidbody  rb    = s.GetComponent <Rigidbody>();
        PlanePilot pilot = PlanePilot.Instance;

        float force = 10f;

        if (pilot)
        {
            float speed = PlanePilot.Instance.flyingSpeed;
            if (useInertia)
            {
                Vector3 heading = PlanePilot.Instance.transform.forward;
                rb.AddForce(heading * speed, ForceMode.VelocityChange);
            }
            else
            {
                force = Mathf.Max(20f, speed * 1.5f);
            }
        }
        else
        {
            force = 20f;
        }

        Vector3 rForce = new Vector3(Random.Range(0f, 1f), Random.Range(0f, 1f), Random.Range(0f, 1f)) * 1f;

        rb.AddTorque(rForce, ForceMode.Impulse);

        rb.AddForce(transform.forward * force, ForceMode.Impulse);

        audio.Play();
    }
Exemple #3
0
 //-----------------------------------------------------------
 void Start()
 {
     // Finding the plane pilot script in the components
     pilot = GetComponent <PlanePilot>();
 }
 // Use this for initialization
 void Start()
 {
     planePilot = player.GetComponent<PlanePilot>();
     planePilot.StartLevel();
     PlanePilot.OnMoved +=onMove;
     PlanePilot.OnGetTarget +=onTarget;
     PlanePilot.OnGetDamage +=onDamage;
     StartCoroutine(GrandPaSaying("Okay, little shit, try to hold the wheel in the center and not to kill us.", 4));
 }