Exemplo n.º 1
0
    void Start()
    {
        fireCooldown = fireCooldownMax;

        headCollider = GetComponentInChildren <HeadCollider>();
        rigidbody    = GetComponent <Rigidbody2D> ();
        ballHandler  = GetComponentInChildren <BallHandler>();

        KeyValuePair <int, Vector3> spawnData = gameHandler.spawn();

        transform.position = spawnData.Value;
        inputs             = new Inputs(spawnData.Key);

        InitControllers();

        mAnimator = GetComponent <Animator>();

        if (inputs.ID == 1)
        {
            ballHandler = transform.Find("BallRed").GetComponent <BallHandler>();
            mAnimator.runtimeAnimatorController = controllerP1;
        }
        else
        {
            ballHandler = transform.Find("BallBlue").GetComponent <BallHandler>();
            mAnimator.runtimeAnimatorController = controllerP2;
        }

        ballHandler.gameObject.SetActive(true);
    }
Exemplo n.º 2
0
 // Use this for initialization
 void Start()
 {
     controller   = GameObject.FindGameObjectWithTag("GoalSpawner").GetComponent <GoalSpawnController>();
     headcollider = GameObject.Find("HeadCollider").GetComponent <HeadCollider>();
     audio        = gameObject.GetComponent <AudioSource>();
 }