Esempio n. 1
0
    // Use this for initialization
    void Start()
    {
        if (soundEffects == null)
        {
            soundEffects = GameObject.FindGameObjectWithTag("AudioManager").GetComponent <SoundEffectsManager>();
        }
#if UNITY_STANDALONE
        m_InGamePauseCanvas = GameObject.FindGameObjectWithTag(m_canvasTagname);
#endif
#if UNITY_ANDROID
        // Since there will only be 1 joystick!
        thePlayerJoystick = FindObjectOfType <PlayerDrag>();
#endif
        arrowTransform = GetComponent <RectTransform>();
        GameObject[] allTheInGamePauseButtons = GameObject.FindGameObjectsWithTag(m_buttonTags);
        foreach (GameObject zeGO in allTheInGamePauseButtons)
        {
            //Debug.Log("Pause button name: " + zeGO.name);
            PauseButtonScript zePause = zeGO.GetComponent <PauseButtonScript>();
            if (zePause != null)
            {
                allThePauseButtons.Add(zePause.m_Number, zePause);
            }
        }
    }
Esempio n. 2
0
 protected virtual void Awake()
 {
     player              = FindObjectOfType <Player>();
     ship                = FindObjectOfType <Ship>();
     creditManager       = CreditManager.Instance();
     soundEffectsManager = SoundEffectsManager.Instance();
 }
Esempio n. 3
0
    // Use this for initialization
    void Start()
    {
        MM        = GetComponent <MoleculeManager>();
        LM        = GetComponent <LevelManager>();
        manager   = GetComponent <Manager>();
        BBManager = GameObject.FindGameObjectWithTag("Board").GetComponent <BlackBoardManager>();
        IM        = GameObject.Find("Info").GetComponent <InformationManager>();

        PS = GetComponent <PointSystem>();
        if (levelsFile != "")
        {
            levels = HandleTextFile.ReadLevels(levelsFile);
        }
        //APMultiple = GameObject.Find("ControlPanelAnswers").GetComponent<AnswerPanel>();
        //APSingle = GameObject.Find("ControlPanelAnswer").GetComponent<AnswerPanel>();
        levelComplete    = false;
        newLevel         = true;
        getAnswer        = false;
        correctMolLoaded = false;
        partialCreated   = false;
        canCreateNew     = true;
        restore          = false;
        level            = 1;
        string[] info = new string[2] {
            "1", "multiple choice"
        };
        Logs.BeginFile(fileName, info);
        SoundEffectsManager.SetUp();
    }
    private void Awake()
    {
        player       = FindObjectOfType <Player>();
        levelEffects = GetComponents <LevelEffect>().ToList();

        soundEffectsManager = FindObjectOfType <SoundEffectsManager>();
    }
Esempio n. 5
0
 private void CreateBondTaps(int taps)
 {
     DefineBondTypeTaps(atom1, atom2, taps);
     if (bondType != -1)
     {
         GameObject newBond = Instantiate(bond, transform.position, transform.rotation);
         AddBond(newBond);
         newBond.GetComponent <BondController> ().SetAtoms(atom1, atom2, bondType);
         newBond.transform.localScale += new Vector3(bondScale, bondScale, 0);
         newBond.transform.parent      = transform;
         atom1.transform.parent        = transform;
         atom2.transform.parent        = transform;
         bondingAtoms = false;
         lastInviBond.GetComponent <FeedbackBondController> ().DestroyBond(atom1, atom2);
         SoundEffectsManager.PlaySound("atomsBonded");
     }
     else
     {
         lastInviBond.GetComponent <FeedbackBondController> ().DestroyBond(atom1, atom2);
         SoundEffectsManager.PlaySound("bondBreak");
         bondingAtoms = false;
     }
     RemoveAllBondsNotAttached();
     bondType         = 0;
     numberOfTaps     = 0;
     lastInviBondType = 0;
 }
Esempio n. 6
0
 private void CheckCollision()
 {
     Collider[] colliders = Physics.OverlapBox(transform.position, transform.localScale / 5);
     if (colliders.Length > 1)
     {
         for (int i = 0; i < colliders.Length; i++)
         {
             if (colliders[i].transform.name.Split(' ')[0] == "Contact" && panelIsActive && canPush)
             {
                 canPush = false;
                 SoundEffectsManager.PlaySound("buttonAnswer");
                 GM.SetPressedAnswer(Button);
                 GM.UpdateLevel();
                 animator.SetBool("pushed", true);
                 if (canPlay)
                 {
                     SoundEffectsManager.PlaySound("button");
                     canPlay = false;
                 }
                 Invoke("Reset", 1f);
                 break;
             }
         }
     }
 }
Esempio n. 7
0
 void Start()
 {
     chargeCyclone       = RegenerateEnergyOverTime();
     shipAnim            = ship.GetComponentInChildren <Animator>();
     anim                = GetComponentInChildren <Animator>();
     soundEffectsManager = SoundEffectsManager.Instance();
 }
 void OnDestroy()
 {
     if (instance && instance == this)
     {
         instance = null;
     }
 }
Esempio n. 9
0
 void Start()
 {
     musicManager        = MusicManager.Instance();
     soundEffectsManager = SoundEffectsManager.Instance();
     SumEnemies(enemySpawners);
     //Debug.Log("No. Enemies Total**************************************** " + sumEnemies.ToString());
 }
Esempio n. 10
0
    protected override void Awake()
    {
        base.Awake();

        playerSoundManager  = GetComponent <PlayerSoundManager>();
        soundEffectsManager = FindObjectOfType <SoundEffectsManager>();

        controls  = new PlayerControls();
        abilities = new List <Ability>();

        //--- Events ---//

        //When movement input is received, use that input to move or activate an ability in that direction
        controls.Movement.Move.performed += ctx => ProcessMoveInput(ctx.ReadValue <Vector2>());
        //When pause input is received, pause the game and fire the pause menu event
        controls.Movement.Pause.performed += _ => PauseManager.TogglePause?.Invoke();
        //When bottom row keys are pressed, try to activate the corresponding ability.
        controls.Movement.Ability0.performed += _ => TryActivateAbility(0);
        controls.Movement.Ability1.performed += _ => TryActivateAbility(1);
        controls.Movement.Ability2.performed += _ => TryActivateAbility(2);
        controls.Movement.Ability3.performed += _ => TryActivateAbility(3);
        controls.Movement.Ability4.performed += _ => TryActivateAbility(4);
        controls.Movement.Ability5.performed += _ => TryActivateAbility(5);
        controls.Movement.Ability6.performed += _ => TryActivateAbility(6);
        //When paused, diallow movement / abilities
        PauseManager.PauseGame += paused => canAct = !paused;
    }
Esempio n. 11
0
 private void Update()
 {
     matrix.Set(coordinates, this);
     if (TickManager.GetTickComplete())
     {
         if (isTouchingPlayer && summon == null)
         {
             SoundEffectsManager.Play("Snap");
             Instantiate(go);
             fiesta.material  = second;
             isTouchingPlayer = false;
         }
     }
     if (summon)
     {
         target = new Vector3(0, -0.09f, 0);
     }
     else if (fiesta.material = second)
     {
         fiesta.material = first;
         target          = Vector3.zero;
     }
     else
     {
         target = Vector3.zero;
     }
     model.transform.localPosition = Vector3.SmoothDamp(model.transform.localPosition, target, ref velocity, 0.05f);
 }
Esempio n. 12
0
    /// <summary>
    /// Sets the board we are looking at
    /// </summary>
    /// <param name="boardId">Id of board to look at</param>
    private void switchViewImpl(int boardId)
    {
        // If offline (play in editor) there is no second board
        if (!PhotonNetwork.IsConnected)
        {
            boardId = m_id;
        }

        if (m_viewBoard != boardId)
        {
            BoardManager board = GameManager.manager.getBoardManager(boardId);
            if (board)
            {
                transform.position = board.ViewPosition;
                m_viewBoard        = boardId;

                if (m_playerUI)
                {
                    m_playerUI.notifyScreenViewSwitch(m_viewBoard == m_id);
                }
            }

            SoundEffectsManager.setActiveGroup(m_viewBoard);
        }
    }
Esempio n. 13
0
    void OnTriggerEnter2D(Collider2D other)
    {
        if (soundEffects == null)
        {
            soundEffects = GameObject.FindGameObjectWithTag("AudioManager").GetComponent <SoundEffectsManager>();
        }
        // Items is for player ultimately. It will be trouble if monster can even pick up the stuff!
        if (other.tag.Equals("Player"))
        {
            // Need to find the inventory again if can't find it!
            if (playerInventory == null)
            {
                Start();
            }
            if (theItemStuff == null)
            {
                Start();
            }
            Debug.Log("Interacting with: " + other.name);
            playerInventory.passInInventory(theItemStuff.m_itemInform);

            // We also need to give the player back some health!
            HealthScript zePlayerHealth = other.GetComponent <HealthScript>();
            zePlayerHealth.modifyHealth(m_heal);

            itemInteractParticles.transform.position = transform.position;
            itemInteractParticles.playEffect();
            if (soundEffects != null)
            {
                soundEffects.playSound("pickupItems");
            }
            Destroy(gameObject);
        }
    }
Esempio n. 14
0
    void OnTriggerEnter2D(Collider2D col)
    {
        if (col.gameObject.CompareTag("Player"))
        {
            // SoundEffectsManager.PlaySound("hit");
            // float dirX = Random.Range(-5.0f, 5.0f);
            float dirY = Random.Range(1.0f, 5.0f);

            float dirX = transform.position.x - col.transform.position.x;

            direcao = new Vector3(dirX * 1.5f, dirY).normalized;

            // } else if (col.gameObject.CompareTag("Parede")) {
            //     if (direcao.x > 0){
            //         direcao = new Vector3(-direcao.x, direcao.y);
            //     }
            //     if (direcao.y > 0) {
            //         direcao = new Vector3(direcao.x, -direcao.y);
            //     }
            //     if (direcao.x < 0) {
            //         direcao = new Vector3(direcao.x, -direcao.y);
            //     }
        }
        else if (col.gameObject.CompareTag("Tijolo"))
        {
            Transform newExplosion = Instantiate(explosion, transform.position, transform.rotation);
            Destroy(newExplosion.gameObject, 2.5f);
            SoundEffectsManager.PlaySound("hit2");
            direcao = new Vector3(direcao.x, -direcao.y);
            gm.pontos++;
        }
    }
 void Awake()
 {
     if (Instance != null)
     {
         Debug.LogError("Multiple instances of SoundEffectsManager!");
     }
     Instance = this;
 }
Esempio n. 16
0
 private void onFired(Vector2 targetPos, bool killed)
 {
     if (m_effectPrefab)
     {
         Instantiate(m_effectPrefab, new Vector3(targetPos.x, targetPos.y, -0.02f), Quaternion.Euler(0f, 0f, Random.Range(0, 360.0f)));    //value by z is -0.02f to make the prefab seen before the ground. - Ivan K.
     }
     SoundEffectsManager.playSoundEffect(m_shootSound, Board);
 }
    private void Awake()
    {
        soundEffectsManager = FindObjectOfType <SoundEffectsManager>();

        PauseGame             += OnGamePaused;
        TogglePause           += OnTogglePaused;
        LevelManager.OnLoaded += _ => PauseGame?.Invoke(false);
    }
Esempio n. 18
0
    // Update is called once per frame

    void Start()
    {
        if (soundEffects == null)
        {
            soundEffects = GameObject.FindGameObjectWithTag("AudioManager").GetComponent <SoundEffectsManager>();
        }
        shouldCarryOn = new bool[anyoneToTakeNoteOf.Length];
    }
Esempio n. 19
0
 // Use this for initialization
 void Start()
 {
     soundEffects = GameObject.FindGameObjectWithTag("AudioManager").GetComponent <SoundEffectsManager>();
     //transform.rotation = Quaternion.FromToRotation(zeDirection, Vector3.down);
     theArrowPhysics     = GetComponent <Rigidbody2D>();
     arrowParticleEffect = GameObject.Find(m_particleSystemName);
     //Debug.Log("Instantiated");
 }
Esempio n. 20
0
 // Use this for initialization
 void Start()
 {
     if (soundEffects == null)
     {
         soundEffects = GameObject.FindGameObjectWithTag("AudioManager").GetComponent <SoundEffectsManager>();
     }
     rb = GetComponent <Rigidbody2D>();
 }
Esempio n. 21
0
 void Update()
 {
     if (soundEffects == null)
     {
         soundEffects = GameObject.FindGameObjectWithTag("AudioManager").GetComponent <SoundEffectsManager>();
     }
     currState.UpdateState();
 }
Esempio n. 22
0
 // Use this for initialization
 void Start()
 {
     if (soundEffects == null)
     {
         soundEffects = GameObject.FindGameObjectWithTag("AudioManager").GetComponent <SoundEffectsManager>();
     }
     GetComponent <RectTransform>().anchoredPosition = stuff[lookAt].GetComponent <RectTransform>().anchoredPosition;
 }
Esempio n. 23
0
 public void OpenCapsule(GameObject mol)
 {
     animator.SetBool("open", true);
     hasMolecule = true;
     molecule    = mol;
     SoundEffectsManager.PlaySound("shelfSlidderOpen");
     Invoke("Reset", 0.5f);
 }
Esempio n. 24
0
 public void CloseCapsule()
 {
     animator.SetBool("close", true);
     hasMolecule = false;
     molecule    = null;
     SoundEffectsManager.PlaySound("shelfSlidderClose");
     Invoke("Reset", .5f);
 }
Esempio n. 25
0
    protected override void Start()
    {
        musicManager        = MusicManager.Instance();
        soundEffectsManager = SoundEffectsManager.Instance();

        health.value = fullHealth;
        StartCoroutine(RegenerateShieldOverTime());
        this.OnDeath += OnShipDeath;
    }
Esempio n. 26
0
    private void setShieldEnabled(bool bEnable)
    {
        if (bEnable != m_shieldActive)
        {
            // Can't active shield while on cooldown
            if (bEnable && m_cooldownActive)
            {
                return;
            }

            m_shieldActive = bEnable;

            if (m_shieldObject)
            {
                m_shieldObject.SetActive(m_shieldActive);
            }

            if (m_monster)
            {
                m_monster.setCanBeDamaged(!m_shieldActive);
            }

            if (m_shieldActive)
            {
                if (m_collisionRoutine == null)
                {
                    m_collisionRoutine = StartCoroutine(checkCollisionRoutine());
                }

                Invoke("onShieldExpired", m_shieldDuration);
            }

            // Play sounds
            {
                // TODO: Make a base class for monster scripts (Like TowerScripts). This would handle getting monster on awake
                // for now
                MonsterBase monster = GetComponent <MonsterBase>();
                if (monster)
                {
                    if (m_shieldActive)
                    {
                        if (m_activeSound)
                        {
                            SoundEffectsManager.playSoundEffect(m_activeSound, monster.Board);
                        }
                    }
                    else
                    {
                        if (m_deactiveSound)
                        {
                            SoundEffectsManager.playSoundEffect(m_deactiveSound, monster.Board);
                        }
                    }
                }
            }
        }
    }
Esempio n. 27
0
    private void onFired(Vector3 position)
    {
        SoundEffectsManager.playSoundEffect(m_shootSound, m_monster.Board);

        if (m_effectPrefab)
        {
            Instantiate(m_effectPrefab, position, Quaternion.identity);
        }
    }
Esempio n. 28
0
 public SpaceShip(
     Game i_Game,
     GameScreen i_Screen,
     string i_AssetName,
     ShootsManager i_ShootsManager) :
     base(i_Game, i_Screen, i_AssetName)
 {
     m_ShootsManager = i_ShootsManager;
     m_SoundManager  = SoundEffectsManager.GetInstance(i_Game);
 }
Esempio n. 29
0
 void Start()
 {
     soundEffects    = GameObject.FindGameObjectWithTag("AudioManager").GetComponent <SoundEffectsManager>();
     bgm             = GameObject.FindGameObjectWithTag("AudioManager").GetComponent <BgmManager>();
     currProjectiles = new GameObject[12];
     Arrow.SetActive(false);
     currState = sleep;
     anim.Play("golemboss_sleep");
     attackMode = "normal";
 }
Esempio n. 30
0
 private void Awake()
 {
     if (!musicManager)
     {
         musicManager = FindObjectOfType <MusicManager>();
     }
     if (!soundEffectsManager)
     {
         soundEffectsManager = FindObjectOfType <SoundEffectsManager>();
     }
 }
Esempio n. 31
0
    void Start()
    {
        ResetSpeed();
        if (gameMode == GameMode.BOOST)
        {
            CoreSystem.onSoundEvent += IncreasePlayerSpeed;
            CoreSystem.onObstacleEvent += ReducePlayerSpeed;
        }

        startxPos = transform.position.x;
        soundEffectsManager = GetComponent<SoundEffectsManager>();
        rigidBody = this.GetComponent<Rigidbody>();
        cameraMovement = mainCamera.GetComponent<CameraMovement>();
        lineRenderer = this.GetComponent<LineRenderer>();
        isGrounded = true;
        collisionTempTime = CoreSystem.coolDownTimeInSeconds;
        coolDownflag = false;
    }
Esempio n. 32
0
 public void Awake()
 {
     Instance = this;
 }
Esempio n. 33
0
	// Use this for initialization
	protected void Awake ()
    {
        s_instance = this;
	}