Beispiel #1
0
    private ObstacleBox obstacelBox; // to save the curren cube



    private void Awake()
    {
        // Initializations, getting components and setting the UI text
        obstacelBox        = GameObject.FindWithTag("Cube").GetComponent <ObstacleBox>();
        pickUpLife         = GameObject.FindWithTag("LifePick").GetComponent <PickUpLife>();
        boxLifeText        = GameObject.FindWithTag("Number").GetComponent <TextMesh>();
        snakeLifeText      = GameObject.FindWithTag("Life").GetComponent <TextMesh>();
        snakeLifeText.text = lifePointsSnake.ToString();
        auxLifeSmash       = obstacelBox.LifeSmasher;
        boxLifeText.text   = auxLifeSmash.ToString();
        auxPick            = pickUpLife.LifePickValue;
    }
    void Start()
    {
        jumpAudio = jumpAudio.GetComponent <AudioSource>();
        landAudio = landAudio.GetComponent <AudioSource>();

        playerModel.transform.position = spawnLocationPlayer;

        ObstacleInstantiation();
        PlayerEyeInstantiation();
        obstacleBox    = new ObstacleBox(obstacleBoxArray, playerModel);
        player         = new Player(obstacleBox, jumpAudio, landAudio);
        cameraMovement = new CameraMovement();
        scoreData      = new ScoreData();
    }
 public Player(ObstacleBox obstacleBox, AudioSource jumpAudio, AudioSource landAudio)
 {
     this.obstacleBox = obstacleBox;
     this.jumpAudio   = jumpAudio;
     this.landAudio   = landAudio;
 }