예제 #1
0
 void Start()
 {
     player         = GameObject.Find("player");
     playAct        = player.GetComponent <playerActions> ();
     guiboss        = transform.GetChild(0).GetComponent <GUIManager> ();
     Time.timeScale = 0f;
 }
예제 #2
0
 void OnTriggerEnter(Collider other)
 {
     if (!paused)
     {
         if (InvadersGameData.directionChanged == false && other.tag == "Wall")
         {
             InvadersGameData.invadersDirection *= -1.0f;
             InvadersGameData.directionChanged   = true;
             InvadersGameData.descendInvaders();
         }
         else if (other.tag == "Laser")
         {
             InvadersGameData.notifyDecease(this.invaderID);
             ExplodeAndDestroy();
             InvadersGameData.Score             = InvadersGameData.Score + 1;
             InvadersGameData.remainingInvaders = InvadersGameData.remainingInvaders - 1;
         }
         else if (other.tag == "Player")
         {
             playerActions pa = other.GetComponent <playerActions>();
             pa.ExplodeAndDestroy();
             ExplodeAndDestroy();
         }
     }
 }
예제 #3
0
 // Use this for initialization
 void Start()
 {
     player    = GameObject.Find("player");
     rig       = gameObject.GetComponent <Rigidbody2D> ();
     playerAct = player.GetComponent <playerActions> ();
     myName    = transform.parent.GetChild(0).GetComponent <mobName> ().myName;
     anim      = transform.GetChild(1).GetComponent <Animator> ();
     audioS    = gameObject.GetComponent <AudioSource> ();
     maxSpeed  = Mathf.Clamp(Random.Range(2f, 3f) + GameObject.Find("Mob spawner").GetComponent <mobSpawner> ().elapsedTime *(1f / 50f), 2f, 8f);
 }
예제 #4
0
 // Use this for initialization
 void Start()
 {
     playerStatus = GameObject.FindGameObjectWithTag("Player");
     playerAct    = playerStatus.GetComponent <playerActions>();
     catBody      = this.GetComponent <Rigidbody>();
     Debug.Log(playerStatus.name);
     rand = new System.Random();
     rand.Next();
     timeLimit = rand.Next(timeMin, timeMax);
     rotation  = new Vector3(0, rand.Next(), 0);
     transform.Rotate(rotation);
     randomDir     = this.transform.forward;
     effectDistLim = 30.0f;
 }
예제 #5
0
    public void PlaySound(playerActions clip)
    {
        if (audioEffects != null)
        {
            switch (clip)
            {
            case playerActions.jump: audioEffects.PlayOneShot(playerJumpSound); break;

            case playerActions.die: audioEffects.PlayOneShot(playerDieSound); break;

            case playerActions.slide: audioEffects.PlayOneShot(playerSlideSound); break;
            }
        }
    }
예제 #6
0
 void OnTriggerEnter(Collider other)
 {
     if (!paused)
     {
         if (other.tag == "WallDestroyer")
         {
             Destroy(gameObject);
         }
         else if (other.tag == "Player")
         {
             playerActions pa = other.GetComponent <playerActions>();
             pa.ExplodeAndDestroy();
             Destroy(gameObject);                 // Destruye el rocket
         }
     }
 }
예제 #7
0
    void Start()
    {
        //Flag is false, default to regular platforming movement
        triggerTextboxMovement = false;

        controller = GetComponent <playerController> ();
        actions    = GetComponent <playerActions> ();

        wallJumpTowards = new Vector2(12f, 20f);
        wallJumpAway    = new Vector2(18f, 17f);
        wallJumpNeutral = new Vector2(8.5f, 7f);

        gravity = -(2 * maxJumpHeight) / Mathf.Pow(timeToJumpApex, 2);

        maxJumpvelocity = Mathf.Abs(gravity) * timeToJumpApex;
        //minJumpVelocity = Mathf.Sqrt (2 * Mathf.Abs (gravity) * minJumpHeight);
        //maxJumpvelocity = 16f;
        minJumpVelocity = 0.1f;
    }
예제 #8
0
    // Use this for initialization

    void Start()
    {
        this.transform.gameObject.SetActive(false);
        playerStatus = GameObject.FindGameObjectWithTag("Player");
        playerAct    = playerStatus.GetComponent <playerActions>();
    }
예제 #9
0
 // Use this for initialization
 void Start()
 {
     playerInv = GameObject.Find("player").GetComponent <playerActions>();
 }
예제 #10
0
    private void selectPlayerAction()
    {
        switch (selectedItem)
        {
            case (0):
                playChangeAnimation("Change");
                playerAction = playerActions.empty;

            break;

            case (1):
            if (isMushroomUsable)
            {
                playChangeAnimation("Change");
                playerAction = playerActions.mushroom;

            }
            else
                selectedItem++;

            break;

            case (2):
                if(isPlantUsable)
                {
                    playChangeAnimation("Change");
                    playerAction = playerActions.tendril;

                }
                else
                    selectedItem++;
            break;

            case (3):
                if(isWaterplantUsable)
                {
                    playChangeAnimation("Change");
                    playerAction = playerActions.waterplant;

                }
                else
                    selectedItem++;
                break;
        }
    }