Пример #1
0
 public void DefineParaEstadoStunned()
 {
     tintImage     = corTingeStunned;
     timerEmEstado = tempoStunned;
     estadoActual  = EstadoPatrulha.Stunned;
     AudioSupport.PlaySom("Stunned");
 }
Пример #2
0
        public void UpdateEstadoHeroi(GameTime gametime, Vector2 delta, bool houveDisparo)
        {
            base.Update();
            boundToCamera();
            //Controlo jogador
            Posicao += delta / 2;

            //direcao do sprite
            if (delta.X > 0)
            {
                SpriteLinhaActual = 1;
            }
            else if (delta.X < 0)
            {
                SpriteLinhaActual = 0;
            }

            //Direcao do disparo
            int direcaoDisparo = 1;

            if (SpriteLinhaActual == 0)
            {
                direcaoDisparo = -1;
            }



            float deltaTime = gametime.ElapsedGameTime.Milliseconds;

            tempoUltimoDisparo += deltaTime / 1000;

            //verifica se pode fazer disparo
            if (tempoUltimoDisparo >= ktempoEntreDisparos)
            {
                if (houveDisparo)
                {
                    Shooting j = new Shooting(new Vector2(Posicao.X + kDisparoFora * direcaoDisparo, Posicao.Y), direcaoDisparo);
                    disparos.Add(j);
                    tempoUltimoDisparo = 0;
                    AudioSupport.PlaySom("gun");
                }
            }
            //update de todos os disparos
            int count = disparos.Count;

            for (int i = count - 1; i >= 0; i--)
            {
                if (!disparos[i].BalaEstaNoEcra())
                {
                    disparos.RemoveAt(i);
                }
                else
                {
                    disparos[i].Update();
                }
            }
        }
Пример #3
0
 public void StealthHeroi()//Era o Unstunnable
 {
     if (estadoActual != EstadoHeroi.Morto && estadoActual != EstadoHeroi.Stunned)
     {
         estadoActual = EstadoHeroi.Stunned;
         AudioSupport.PlaySom("Stun");
         AjustaVida(-1);
     }
 }
Пример #4
0
        public void Update(GameTime gametime, Vector2 delta, bool houveDisparo)
        {
            switch (estadoActual)
            {
            case EstadoHeroi.Andar:
                UpdateEstadoHeroi(gametime, delta, houveDisparo);
                AudioSupport.PlaySom("walk fast");

                break;
            }
        }
Пример #5
0
    private IEnumerator ResolveDestruction()
    {
        if (OnDeathSound != null)
        {
            AudioSupport.PlayClipAt(OnDeathSound, Camera.transform.position);
        }
        yield return(new WaitForSeconds(0.3f));

        OnDeathEvents.ForEach(x => x.Publish());
        Destroy(gameObject);
    }
Пример #6
0
        public bool Morto()
        {
            if (estadoActual == EstadoHeroi.Morto)
            {
                return(true);

                AudioSupport.Background("game over_sound 1", 5f);
            }
            else
            {
                return(false);
            }
        }
Пример #7
0
    private void PlaySound(Health health)
    {
        if (!IsDeadly)
        {
            return;
        }

        if (health == null || health.Role.Equals(OwnedBy))
        {
            return;
        }
        if (OnHitSound != null)
        {
            AudioSupport.PlayClipAt(OnHitSound, _camera.transform.position);
        }
    }
Пример #8
0
    private IEnumerator HealSleep()
    {
        if (isFinished)
        {
            yield break;
        }

        CloseDoor();

        AudioSupport.PlayClipAt(sleepSound, gameCamera.transform.position);
        AudioSupport.PlayClipAt(lullaby, gameCamera.transform.position);
        yield return(new WaitForSeconds(sleepDuration / 2));

        gameState.HealthMap[gameState.CatId] = gameState.MaxHP;
        yield return(new WaitForSeconds(sleepDuration / 2));

        // TODO: Close Door afterwards

        openDoor.SetActive(true);
        closedDoor.SetActive(false);
        isFinished = true;
    }
Пример #9
0
 public void AumentoVida()
 {
     AjustaVida(2);
     AudioSupport.PlaySom("Ration");
 }