Ejemplo n.º 1
0
 public void PlayerShooting()
 {
     /** Key Actions**/
     if (Input.GetKeyDown(KeyCode.F))
     {
         Fire = true;
         GameObject bullet = Instantiate(bulletPref, bulletSpawner.position, bulletSpawner.rotation);
         bullet.GetComponent <Rigidbody2D> ().velocity = new Vector2(bulletSpeed, 2);
         if (playerT.localScale.x > 0)
         {
             bullet.GetComponent <Rigidbody2D> ().velocity = new Vector2(bulletSpeed, 2);
             transform.localScale = new Vector3(1f, 1f, 1f);
         }
         else
         {
             bullet.GetComponent <Rigidbody2D> ().velocity = new Vector2(-bulletSpeed, 2);
             transform.localScale        = new Vector3(-1f, 1f, 1f);
             bullet.transform.localScale = new Vector3(-1f, 1f, 1f);
         }
         Destroy(bullet, 2.0f);
     }
     if (Input.GetKeyUp(KeyCode.F))
     {
         Fire = false;
         SoundsManager.PlaySound("firePlayer");
         //WinnerController.ActiveWin (true);
     }
 }
Ejemplo n.º 2
0
    public void StartDrag(bool isSwap = false)
    {
        //Debug.Log("OnBeginDrag: " + gameObject.name);

        if (CombatPlayer.isDead)
        {
            return;
        }

        DraggedLoot = this;

        if (MySlot != null)
        {
            RemoveFromSlot();
        }

        if (isSwap == false)
        {
            SoundsManager.PlayRandomClip(PickupSounds);
        }

        //GetComponent<CanvasGroup>().interactable = false;
        //GetComponent<CanvasGroup>().blocksRaycasts = false;

        this.transform.SetParent(GetComponentInParent <Canvas>().transform);
        this.transform.SetAsLastSibling();
    }
Ejemplo n.º 3
0
    private void spawnHitEffect(float inOldNailPassedHeight, float inNewNailPassedHeight, float inHeightToPass, Vector2 inHitRelativePosition)
    {
        float theHalfHeightToPass = inHeightToPass / 2;

        ParticleSystem theParticleSystemToSpawn = null;

        //Default only if speed is enough
        float theRatioHeightPassedByHit = (inNewNailPassedHeight - inOldNailPassedHeight) / inHeightToPass;

        if (theRatioHeightPassedByHit > _ratioHeightPassedByHitLimitToSpawnEffects)
        {
            theParticleSystemToSpawn = _hitEffectParticleSystem;
        }

        if (inOldNailPassedHeight < theHalfHeightToPass && inNewNailPassedHeight >= theHalfHeightToPass)
        {
            theParticleSystemToSpawn = _halfPassedHitEffectParticleSystem;
        }
        if (inOldNailPassedHeight < inHeightToPass && inNewNailPassedHeight >= inHeightToPass)
        {
            theParticleSystemToSpawn = _fullPassedHitEffectParticleSystem;
            SoundsManager.spawnSoundPlayer(_soundPlayer, _sounds[1], transform.TransformPoint(inHitRelativePosition));
        }

        if (theParticleSystemToSpawn)
        {
            EffectsManager.spawnParticleSystem(theParticleSystemToSpawn, transform.TransformPoint(inHitRelativePosition));
        }

        //SpawnSoundPlayer(_sounds[0], transform.TransformPoint(inHitRelativePosition));
    }
Ejemplo n.º 4
0
    // Start is called before the first frame update
    void Start()
    {
        _xInitPos = transform.position.x;

        _timer = 1;
        //_stat = GetComponent<PlayerStat>();
        _rig          = GetComponent <Rigidbody>();
        _trans        = GetComponent <Transform>();
        _soundManager = GetComponent <SoundsManager>();

        // on desactive les alliés

        for (int i = 0; i < _allies.Length; i++)
        {
            _allies[i].SetActive(false);
        }
        GameManager.identity.stat.initialize();
        for (int i = 0; i < _foods.Length; i++)

        {
            if (i * 10 < GameManager.identity.stat.food)
            {
                _foods[i].SetActive(true);
            }
            else
            {
                _foods[i].SetActive(false);
            }
        }

        if (_cameraAncor == null)
        {
            _cameraAncor = GameObject.Find("CameraAncor").transform;
        }
    }
Ejemplo n.º 5
0
    public void PracticePressed()
    {
        SoundsManager.getInstance().PlayMenuSelectSound();

        Canvas.transform.GetChild(1).gameObject.SetActive(false);
        Canvas.transform.GetChild(3).gameObject.SetActive(true);
    }
Ejemplo n.º 6
0
 public TypeOfPortal(Portal originPortal, TGCVector3 outDirection)
 {
     this.outDirection = outDirection;
     this.originPortal = originPortal;
     this.soundManager = new SoundsManager();
     this.soundManager.AddSound(this.GetPosition(), 10f, 0, "Portal\\Goku.wav", "Goku", false);
 }
    // Plays the background music.
    IEnumerator playMusic()
    {
        yield return(new WaitForSeconds(0.25f));

        SoundsManager.BackgroundNoise();
        SoundsManager.Music();
    }
Ejemplo n.º 8
0
 private void Start()
 {
     soundsManager   = GameObject.Find("SoundsManager").GetComponent <SoundsManager>();
     lightsManager   = GameObject.Find("LightsManager").GetComponent <LightsManager>();
     _ballManager    = FindObjectOfType <BallManager>();
     _missionManager = FindObjectOfType <MissionManager>();
 }
Ejemplo n.º 9
0
    // Use this for initialization
    void Start()
    {
        //各変数の初期化
        bossState   = BossState.Move;
        attackState = AttackState.ShotGun;

        player = GameObject.Find("Player");

        plusHP = GameObject.Find("BossPlusHP").GetComponent <BossPlusHP>();
        HP     = HP + plusHP.GetPlusHP();

        isOnlyRotate = true;

        stopTime = 5.0f;

        attackStartTimeCount = 0.0f;
        laserStartTime       = 60.0f;
        isAttackStart        = false;

        shotGunShotCount = 0;
        shotGundelay_R   = 0.0f;
        shotGundelay_L   = 2.0f;

        hormingShotStart = false;
        hormingShotEnd   = false;
        hormingStopTime  = 5.0f;

        laserStart     = false;
        laserEnd       = false;
        isPanelBreak   = false;
        panelBreakTime = 30.0f;

        sceneManager  = GameObject.Find("ScriptManager").GetComponent <Scene_Manager_>();
        soundsManager = GameObject.Find("ScriptManager").GetComponent <SoundsManager>();
    }
Ejemplo n.º 10
0
    private void SpawnSoundPlayerHit(float theDistanceToPassClamped, Sound sound, Vector2 positionSpawn)
    {
        AudioSource soundPlayerAudioSourse = SoundsManager.spawnSoundPlayer(_soundPlayer, sound, positionSpawn);
        float       newVolume = theDistanceToPassClamped / heightToPass * sound._volume;

        soundPlayerAudioSourse.volume = newVolume;
    }
Ejemplo n.º 11
0
 void _makeInstance()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
Ejemplo n.º 12
0
        public SignalObject(int x, int y) : base("signal")
        {
            _animationManager = new AnimationManager(false)
            {
                Increment = 0.05, AnimationType = AnimationType.EaseOut
            };
            UpdatePosition(x, y);

            /*_animationManager.OnAnimationProgress += (sender) =>
             * {
             *
             * };
             *
             * _animationManager.OnAnimationFinished += (sender) =>
             * {
             *
             * };*/

            if (Global.SettingsCollection["alertsounds"].ToBool())
            {
                SoundsManager.Play(SOUNDS_TYPE.SIGNAL);
            }

            LifeTime = DateTime.Now.TimeOfDay.Add(TimeSpan.FromSeconds(2));
        }
Ejemplo n.º 13
0
 void Start()
 {
     gunScale      = gunSprite.localScale;
     charaScale    = charaSprite.localScale;
     soundsManager = GameObject.FindObjectOfType <SoundsManager>();
     cameraSize    = camera.orthographicSize;
 }
Ejemplo n.º 14
0
    private void changeAsset(Direction direction)
    {
        //Play sound
        SoundsManager.PlaySound(SoundsManager.Sound.Moves);

        switch (direction)
        {
        default:
        case Direction.Up:
            snakeBody.SetFloat("Horizontal", 0);
            snakeBody.SetFloat("Vertical", 1);
            break;

        case Direction.Down:     //Down
            snakeBody.SetFloat("Horizontal", 0);
            snakeBody.SetFloat("Vertical", -1);
            break;

        case Direction.Right:     //Right
            snakeBody.SetFloat("Horizontal", 1);
            snakeBody.SetFloat("Vertical", 0);
            break;

        case Direction.Left:     //Left
            snakeBody.SetFloat("Horizontal", -1);
            snakeBody.SetFloat("Vertical", 0);
            break;
        }
    }
Ejemplo n.º 15
0
    public void AddToSlot(BagSlot s)
    {
        MySlot = s;

        if (MySlot.Backpack == null)
        {
            // This is an inventory slot -- check for type match?
            //       Was already done in an earlier step
            MySlot.MyLoot = this;

            if (lootStats.itemType == ItemTypes.Potion)
            {
                SoundsManager.PlayRandomClip(PotionDrinkSounds);
            }

            // We need to apply the item stats to our character
            this.GetComponent <LootStats>().ApplyStats();
            return;
        }

        // Add to all slots
        BagSlot[] slots = MySlot.Backpack.GetSlotsAt(MySlot.PosX, MySlot.PosY, GridWidth, GridHeight);

        foreach (BagSlot bs in slots)
        {
            bs.MyLoot = this;
        }
    }
Ejemplo n.º 16
0
 void Start()
 {
     gameManager   = FindObjectOfType <GameManager>();
     soundsManager = GameObject.Find("SoundsManager").GetComponent <SoundsManager>();
     _text         = GetComponent <TextMeshProUGUI>();
     _text.enabled = false;
 }
Ejemplo n.º 17
0
    private void Show()
    {
        //Play sound
        SoundsManager.PlaySound(SoundsManager.Sound.gameOver);

        float score = GameHandler.GetScore() + ((float)GameHandler.GetScore() / GameHandler.GetTime());

        //Load le score actuel
        transform.Find("TxtScoreObtained").GetComponent <Text>().text = "VOUS AVEZ EU " + (int)score + " POINTS";
        //Donner le score
        Score.setScore((int)(GameHandler.GetScore() + ((float)GameHandler.GetScore() / GameHandler.GetTime())));
        //Update le tableau
        Score.updateHighscore();

        //Load le highscore
        string highscore = Score.GetHighScore().ToString();

        for (int i = 1; i < 5; i++)
        {
            highscore += "\n" + Score.GetHighScore(i).ToString();
        }

        transform.Find("TxtScore").GetComponent <Text>().text = highscore;

        string highscorePseudo = Score.GetHighScorePseudo().ToString();

        for (int i = 1; i < 5; i++)
        {
            highscorePseudo += "\n" + Score.GetHighScorePseudo(i).ToString();
        }

        transform.Find("TxtPseudo").GetComponent <Text>().text = highscorePseudo;

        gameObject.SetActive(true);
    }
Ejemplo n.º 18
0
    public void SetConfused()
    {
        SoundsManager.getInstance().PlayConfusedEffect();
        transform.GetChild(4).gameObject.SetActive(true);

        Invoke("CureConfused", StatusDuration);
    }
Ejemplo n.º 19
0
 void Start()
 {
     soundsManager   = GameObject.Find("SoundsManager").GetComponent <SoundsManager>();
     _missionManager = GameObject.Find("MissionManager").GetComponent <MissionManager>();
     _lockedBalls    = new Queue <Rigidbody>();
     _ballManager    = FindObjectOfType <BallManager>();
 }
Ejemplo n.º 20
0
    public void SetFrozen()
    {
        SoundsManager.getInstance().PlayFrozenEffect();
        transform.GetChild(3).gameObject.SetActive(true);

        Invoke("CureFrozen", StatusDuration);
    }
Ejemplo n.º 21
0
    public void SetOnFire()
    {
        SoundsManager.getInstance().PlayOnFireEffect();
        transform.GetChild(2).gameObject.SetActive(true);

        Invoke("CureOnFire", StatusDuration);
    }
Ejemplo n.º 22
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AudioPlayer" /> class.
        /// </summary>
        /// <param name="xaudio2">The xaudio2 engine.</param>
        /// <param name="audioStream">The input audio stream.</param>
        public AudioPlayer(string file)
        {
            this.xaudio2 = new XAudio2();
            audioDecoder = new AudioDecoder(SoundsManager.getAudioStream(file));
            var test = SoundsManager.getAudio(file);

            sourceVoice = new SourceVoice(test.Item4, test.Item1, true);
            localVolume = 1.0f;

            sourceVoice.BufferEnd += sourceVoice_BufferEnd;
            sourceVoice.Start();

            bufferEndEvent      = new AutoResetEvent(false);
            playEvent           = new ManualResetEvent(false);
            waitForPlayToOutput = new ManualResetEvent(false);

            clock = new Stopwatch();

            // Pre-allocate buffers
            audioBuffersRing = new AudioBuffer[3];
            memBuffers       = new DataPointer[audioBuffersRing.Length];
            for (int i = 0; i < audioBuffersRing.Length; i++)
            {
                audioBuffersRing[i]   = new AudioBuffer();
                memBuffers[i].Size    = 32 * 1024; // default size 32Kb
                memBuffers[i].Pointer = Utilities.AllocateMemory(memBuffers[i].Size);
            }

            // Initialize to stopped
            State = AudioPlayerState.Stopped;

            // Starts the playing thread
            playingTask = Task.Factory.StartNew(PlayAsync, TaskCreationOptions.LongRunning);
        }
Ejemplo n.º 23
0
    public void Show()
    {
        if (CombatPlayer.isDead)
        {
            return;
        }

        if (PortalCooldown < 1)
        {
            return;
        }

        SoundsManager.PlayClip(PortalSound);

        TownPortalsUsed++;

        PauseManager.isPaused = true;
        PortalCooldown        = 0;
        PortalCooldownTime   += 10f;// + (Difficulty.DiffLevel * 5);

        combatQueue.LeaveDungeon();
        GameObject.FindObjectOfType <LootArea>().ClearLoot();

        itemNameTxt.text = "";
        statGainTxt.text = "";

        DoSale();

        this.transform.SetAsLastSibling();

        StatManager.Instance.HealPlayer();

        // Slide In
        desiredPosition = new Vector2(0, 0);
    }
Ejemplo n.º 24
0
 public void Start()
 {
     _missionManager = GameObject.Find("MissionManager").GetComponent <MissionManager>();
     lightsManager   = GameObject.Find("LightsManager").GetComponent <LightsManager>();
     soundsManager   = GameObject.Find("SoundsManager").GetComponent <SoundsManager>();
     rampLights1     = lightsManager.rampLights1;
     rampLights2     = lightsManager.rampLights2;
 }
Ejemplo n.º 25
0
 public DeadState(ZombieStateMashine stateMashine, NavMeshAgent agent, SoundsManager sounds) : base(stateMashine, agent)
 {
     zombieStateMashine.animator.SetBool("isDead", true);
     if (sounds != null)
     {
         sounds.OnZombieKilled();
     }
 }
Ejemplo n.º 26
0
 public void StartGame()
 {
     StringMessageToClients("ST");
     DontDestroyOnLoad(gameObject);
     SceneManager.LoadScene("Game Scene");
     SoundsManager.getInstance().StopAllSounds();
     Invoke("ActivatePlayer", 1.5f);
 }
Ejemplo n.º 27
0
 // Use this for initialization
 void Start()
 {
     _ballManager  = FindObjectOfType <BallManager>();
     soundsManager = GameObject.Find("SoundsManager").GetComponent <SoundsManager>();
     _text         = GetComponent <TextMeshProUGUI>();
     _oldCount     = _ballManager.BallsLeftCount() - 1;
     _text.text    = _oldCount.ToString();
 }
Ejemplo n.º 28
0
    //Dame khi dính Spike
    public void Damage(int dmg)
    {
        SoundsManager.PlaySound("Hurt");

        curHeath -= dmg;
        // animation trigger Hurt khi player gap phai spikes
        anim.SetTrigger("Hurt");
    }
Ejemplo n.º 29
0
        public CharacterSelect(GameModel gameModel, MyAbstractions.Tgc3dSound init)
        {
            this.gameModel = gameModel;
            this.init      = init;
            this.init.play(true);
            this.planes.Add(new Plane(new TGCVector3(-90, 0, -90), new TGCVector3(90, 0, 90), new TGCVector3(0, 1, 0), "Otros\\Paredes\\2.jpg", 1, 1));
            this.planes.Add(new Plane(new TGCVector3(-90, 0, -90), new TGCVector3(-90, 50, 90), new TGCVector3(1, 0, 0), "Otros\\Paredes\\1.jpg", 1, 1));
            this.planes.Add(new Plane(new TGCVector3(90, 0, -90), new TGCVector3(90, 50, 90), new TGCVector3(-1, 0, 0), "Otros\\Paredes\\4.jpg", 1, 1));
            this.planes.Add(new Plane(new TGCVector3(-90, 0, -90), new TGCVector3(90, 50, -90), new TGCVector3(0, 0, 1), "Otros\\Paredes\\3.jpg", 1, 1));
            this.gameModel.Camara = new ThirdPersonCamera(new TGCVector3(0, 0, 0), 100f, 150f);

            this.soundManager = new SoundsManager();
            var auto1 = new Van(new TGCVector3(0f, 0f, 0f), soundManager);

            auto1.matrixs.SetScalation(TGCMatrix.Scaling(0.2f, 0.2f, 0.2f));
            auto1.Transform();

            this.soundManager = new SoundsManager();
            var auto2 = new Car(new TGCVector3(0f, 0f, 0f), soundManager);

            auto2.matrixs.SetScalation(TGCMatrix.Scaling(0.3f, 0.3f, 0.3f));
            auto2.Transform();

            this.soundManager = new SoundsManager();
            var auto3 = new Hummer(new TGCVector3(0f, 0f, 0f), soundManager);

            auto3.matrixs.SetScalation(TGCMatrix.Scaling(0.25f, 0.25f, 0.25f));
            auto3.Transform();

            autos = new List <Vehicle>
            {
                auto1,
                auto2,
                auto3
            };

            selectedCar = auto1;
            CarsCount   = autos.Count - 1;


            var deviceWidth  = D3DDevice.Instance.Width;
            var deviceHeight = D3DDevice.Instance.Height;

            choose          = new CustomSprite();
            choose.Bitmap   = new CustomBitmap(MediaDir + "GUI\\Menu\\choose.png", D3DDevice.Instance.Device);
            choose.Position = new TGCVector2((deviceWidth / 2f) - choose.Bitmap.Width / 2, deviceHeight * 0.6f);

            rightArrow          = new CustomSprite();
            rightArrow.Bitmap   = new CustomBitmap(MediaDir + "GUI\\Menu\\right-arrow.png", D3DDevice.Instance.Device);
            rightArrow.Position = new TGCVector2(deviceWidth / 2 + rightArrow.Bitmap.Width * 3 / 4, deviceHeight / 2 - rightArrow.Bitmap.Height * 0.2f);
            rightArrow.Scaling  = new TGCVector2(0.2f, 0.2f);

            leftArrow          = new CustomSprite();
            leftArrow.Bitmap   = new CustomBitmap(MediaDir + "GUI\\Menu\\right-arrow.png", D3DDevice.Instance.Device);
            leftArrow.Rotation = FastMath.PI;
            leftArrow.Position = new TGCVector2(deviceWidth / 2 - leftArrow.Bitmap.Width * 3 / 4, deviceHeight / 2);
            leftArrow.Scaling  = new TGCVector2(0.2f, 0.2f);
        }
Ejemplo n.º 30
0
    void StopDrag()
    {
        if (DraggedLoot != this)
        {
            return;
        }

        //Debug.Log("StopDrag " + gameObject.name);
        DraggedLoot = null;

        SoundsManager.PlayRandomClip(DropSounds);


        //GetComponent<CanvasGroup>().interactable = true;
        //GetComponent<CanvasGroup>().blocksRaycasts = true;


        // Do a raycast to see what's under the mouse and find stuff that
        // implements OnDrop

        PointerEventData pointerData = new PointerEventData(EventSystem.current)
        {
            pointerId = -1,
        };

        pointerData.position = Input.mousePosition;

        List <RaycastResult> results = new List <RaycastResult>();

        EventSystem.current.RaycastAll(pointerData, results);

        foreach (RaycastResult rr in results)
        {
            BagSlot bs = rr.gameObject.GetComponent <BagSlot>();
            if (bs != null)
            {
                bs = bs.CanDropHere(this);

                // bs might be changed or could be null now

                if (bs != null)
                {
                    bs.DroppedLoot(this);
                }
                else
                {
                    ResetToLootArea();
                }

                return;
            }
        }



        // If we get here, we didn't hit a slot
        ResetToLootArea();
    }
Ejemplo n.º 31
0
    void Awake() {
        if (_instance == null) _instance = this;
        else {
            DestroyImmediate(this);
            return;
        }

        _player = GameObject.Find("Player");
    }
Ejemplo n.º 32
0
    void Awake()
    {
        if (_instance == null) _instance = this;
        else
        {
          DestroyImmediate(this);
          return;
        }

        _sources = new List<AudioSource>();
        loadSounds();
    }