Пример #1
0
 void Awake()
 {
     // Register the singleton
     if (Instance != null)
     {
         Debug.LogError("Multiple instances of SoundScript!");
     }
     Instance = this;
     DontDestroyOnLoad(transform.gameObject);
 }
Пример #2
0
 // Use this for initialization
 void Start()
 {
     gameStateManager = GameObject.Find("GameStateManager");
     gameStateScript = gameStateManager.GetComponent<GameStateScript>();
     MainCamera = GameObject.Find("Main Camera");
     BackgroundController = MainCamera.GetComponent<BackgroundController>();
     MainGUI = MainCamera.GetComponent<MainGUI>();
     JumpSoundObject = GameObject.Find("JumpSoundDumpster");
     jumpSoundScript = JumpSoundObject.GetComponent<JumpSoundScript>();
     PlayerLose = PlayerStart - 2;
     Lost = false;
     gameStateScript.Lost = false;
     gameStateScript.Won = false;
     gameStateScript.GameOver = false;
 }
Пример #3
0
    void Update()
    {
        if (!dead && deathSensor.dead)
        {
            Death();
        }
        //Вертикальная ось
        bool jumpKeyPressed = Input.GetKeyDown(KeyCode.Space);

        if (!dead && !isJumping && jumpKeyPressed && (jumpSensor.permissionToJump))
        {//обеспечиваем анимацию и готовим и щелкаем триггер на прыжок
            isJumping = true;
            JumpSoundScript.SoundJump();
            psDust.Stop();
            animator.SetTrigger("Jump");
        }
        if (isJumping)
        {//реализуем прыжок
            Jump();
        }
    }