// Use this for initialization
	void Start () {
		throwScript = GetComponent<throwing> ();
		pearlOffset = transform.GetChild(0).gameObject;
		beaverSprite = transform.GetChild (1).gameObject;
		pearlRenderer = pearlOffset.GetComponent<SpriteRenderer>();
		colDetectScript = transform.GetComponent<collision_detection> ();

		InvokeRepeating ("DemoThrow", 0.05f, 2.0f);
	}
Beispiel #2
0
    void OnTriggerEnter2D(Collider2D other)
    {
        if (other.tag == "Pearl")
        {
            Destroy(other.gameObject);


            if (gameObject.tag == "Left_Clam")
            {
                scoreKeeperScript.IncrementLeftScore();

                clamSprite.material.color = leftScoredColor;
            }
            else if (gameObject.tag == "Right_Clam")
            {
                scoreKeeperScript.IncrementRightScore();

                clamSprite.material.color = rightScoredColor;
            }

            animator.SetTrigger("scored");

            //Wait a little bit before spawning a new pearl
            Invoke("CreateNewPearl", 1.5f);
        }
        else if (other.tag == "Player")
        {
            player_state        playerStateScript     = other.gameObject.GetComponentInParent <player_state>();
            collision_detection playerCollisionScript = other.gameObject.GetComponentInParent <collision_detection>();

            if (playerStateScript.GetHasPearl())
            {
                playerCollisionScript.HidePearl();

                playerStateScript.SetHasPearl(false);

                if (gameObject.tag == "Left_Clam")
                {
                    scoreKeeperScript.IncrementLeftScore();

                    clamSprite.material.color = leftScoredColor;
                }
                else if (gameObject.tag == "Right_Clam")
                {
                    scoreKeeperScript.IncrementRightScore();

                    clamSprite.material.color = rightScoredColor;
                }

                animator.SetTrigger("scored");

                //Wait a little bit before spawning a new pearl
                Invoke("CreateNewPearl", 1.5f);
            }
        }
    }
    // Use this for initialization
    void Start()
    {
        throwScript = GetComponent<throwing> ();
        pearlOffset = transform.GetChild(0).gameObject;
        beaverSprite = transform.GetChild (1).gameObject;
        pearlRenderer = pearlOffset.GetComponent<SpriteRenderer>();
        colDetectScript = transform.GetComponent<collision_detection> ();

        InvokeRepeating ("DemoThrow", 0.05f, 2.0f);
    }
Beispiel #4
0
    void Start()
    {
        //get the state script
        playerStateScript = GetComponent <player_state> ();

        //get the
        GameObject beaverSprite = transform.GetChild(1).gameObject;

        beaverMouth = transform.GetChild(1).gameObject;

        beaverPearlCollider = beaverSprite.transform.GetChild(0).gameObject;

        // get Player name form patent object
        Player_name = gameObject.transform.name;


        //gettign the scripts that will be disabled
        movingScript    = GetComponent <moving> ();
        dashScript      = GetComponent <dash> ();
        throwingScript  = GetComponent <throwing> ();
        colDetectScript = GetComponent <collision_detection> ();

        //get the scripts to animate the indicator

//		if (Player_name == "Beaver1") {
//			iconIndicator = GameObject.FindGameObjectWithTag ("iconP1").GetComponent<Animator>();
//
//		} else if (Player_name == "Beaver2") {
//			iconIndicator = GameObject.FindGameObjectWithTag ("iconP2").GetComponent<Animator>();
//		}

        //getting the particle system
        Bubbles = beaverMouth.GetComponentInChildren <ParticleSystem> ();

        //setting the emmision to 0
        Bubbles.emissionRate = 0;

        //initially not suffocating
        //isSuffocating = false;
        playerStateScript.SetIsSuffocating(false);

        // gettign the ridgit body of the Player
        rBody = GetComponent <Rigidbody2D> ();


        // getting the animator.
        animator = transform.GetChild(1).gameObject.GetComponent <Animator> ();

        soundPlayer = GameObject.FindGameObjectWithTag("Sound_Player").GetComponent <sound_player>();
    }
    void Start()
    {
        //get references to the child object
        pearlOffset = transform.GetChild(0).gameObject;
        beaverSprite = transform.GetChild (1).gameObject;

        //get reference to the sprite renderer located on the pearlOffset child object
        pearlRenderer = pearlOffset.GetComponent<SpriteRenderer>();

        throwInputScript = gameObject.GetComponent<get_input>();
        aimingDirScript = gameObject.GetComponent<aiming>();
        colDetectScript = transform.GetComponent<collision_detection> ();
        playerStateScript = GetComponent<player_state>();

        soundPlayer = GameObject.FindGameObjectWithTag ("Sound_Player").GetComponent<sound_player>();
    }
Beispiel #6
0
    void Start()
    {
        //get references to the child object
        pearlOffset  = transform.GetChild(0).gameObject;
        beaverSprite = transform.GetChild(1).gameObject;

        //get reference to the sprite renderer located on the pearlOffset child object
        pearlRenderer = pearlOffset.GetComponent <SpriteRenderer>();

        throwInputScript  = gameObject.GetComponent <get_input>();
        aimingDirScript   = gameObject.GetComponent <aiming>();
        colDetectScript   = transform.GetComponent <collision_detection> ();
        playerStateScript = GetComponent <player_state>();

        soundPlayer = GameObject.FindGameObjectWithTag("Sound_Player").GetComponent <sound_player>();
    }
    void Start()
    {
        //get the state script
        playerStateScript = GetComponent<player_state> ();

        //get the
        GameObject beaverSprite = transform.GetChild (1).gameObject;
        beaverMouth = transform.GetChild (1).gameObject;

        beaverPearlCollider = beaverSprite.transform.GetChild (0).gameObject;

        // get Player name form patent object
        Player_name = gameObject.transform.name;

        //gettign the scripts that will be disabled
        movingScript = GetComponent<moving> ();
        dashScript = GetComponent<dash> ();
        throwingScript = GetComponent<throwing> ();
        colDetectScript = GetComponent<collision_detection> ();

        //get the scripts to animate the indicator

        //		if (Player_name == "Beaver1") {
        //			iconIndicator = GameObject.FindGameObjectWithTag ("iconP1").GetComponent<Animator>();
        //
        //		} else if (Player_name == "Beaver2") {
        //			iconIndicator = GameObject.FindGameObjectWithTag ("iconP2").GetComponent<Animator>();
        //		}

        //getting the particle system
        Bubbles = beaverMouth.GetComponentInChildren<ParticleSystem> ();

        //setting the emmision to 0
        Bubbles.emissionRate = 0;

        //initially not suffocating
        //isSuffocating = false;
        playerStateScript.SetIsSuffocating (false);

        // gettign the ridgit body of the Player
        rBody = GetComponent<Rigidbody2D> ();

        // getting the animator.
        animator = transform.GetChild (1).gameObject.GetComponent<Animator> ();

        soundPlayer = GameObject.FindGameObjectWithTag ("Sound_Player").GetComponent<sound_player>();
    }