예제 #1
0
 // Use this for initialization
 void Start()
 {
     _football = GameObject.Find("PaperFootball").GetComponent <LaunchableObject>();
     _goal     = GameObject.Find("Goal").GetComponent <TextMesh>();
     _goalPost = GameObject.Find("GoalPost").GetComponentInChildren <GoalPostScript>();
     _goalPost.Reset();
 }
예제 #2
0
    private IEnumerator SingleLaunch(LaunchableObject launchableObject, Vector3 force = default(Vector3))
    {
        yield return(new WaitForSeconds(_initialLaunchDelay));

        launchableObject.OnLaunch(force);

        yield return(new WaitForSeconds(_nextLaunchDelay));
    }
예제 #3
0
    private IEnumerator MultipleLaunch(LaunchableObject launchableObject, List <Vector3> forces = null)
    {
        yield return(new WaitForSeconds(_initialLaunchDelay));

        foreach (var force in forces)
        {
            if (force != default(Vector3))
            {
                launchableObject.OnLaunch(force);

                yield return(new WaitForSeconds(_nextLaunchDelay));
            }
        }
    }
예제 #4
0
    private void OnCollisionEnter(Collision collision)
    {
        if (collision.gameObject.name == null)
        {
            return;
        }

        if (_BallDesignationLiterals.Contains(collision.gameObject.name) || _BallDesignationLiterals.Contains(collision.gameObject.tag))
        {
            LaunchableObject launchableObject = collision.gameObject.GetComponent <LaunchableObject>();
            if (launchableObject != null)
            {
                launchableObject.ReceiveCollision(collision);
            }
        }
    }
예제 #5
0
    private void OnCollisionEnter(Collision c)
    {
        if (c.gameObject.name == null)
        {
            return;
        }

        if (c.gameObject.name.Contains(Common.ObjectFilterLiteral) ||
            c.gameObject.tag.Contains(Common.ObjectFilterLiteral))
        {
            LaunchableObject lO = c.gameObject.GetComponentInChildren <LaunchableObject>();
            if (lO != null)
            {
                lO.ReceiveCollision(c);
            }
        }
    }
예제 #6
0
    void Start()
    {
        QualitySettings.vSyncCount = 0;

        GameObject sphere = GameObject.Find("Sphere");

        LaunchableObject launchableObject = sphere.GetComponent <LaunchableObject>();

        StartCoroutine(MultipleLaunch(launchableObject, new List <Vector3>()
        {
            new Vector3(-30, 50, 30),
            new Vector3(40, 30, -30),
            new Vector3(10, 10, 10),
            new Vector3(-5, 30, -5),
            new Vector3(10, 20, 20),
            new Vector3(-20, 20, 20),
            ////new Vector3(-10, 20, 10) // Add a third or fourth launch, etc.
        }));
    }