PlayerVoice() public static method

public static PlayerVoice ( ) : void
return void
示例#1
0
 public override void takeDamage(int damage)
 {
     base.takeDamage(damage);
     //play an obscenity
     if (Random.Range(0, 5) == 0)
     {
         SFXManager.PlayerVoice();
     }
 }
示例#2
0
    //this override exists only for debug logging purposes.

    /*
     * protected override bool AttemptMove(Move move)
     * {
     *      Debug.Log(gameObject.name + " attempts move " + move);
     *      bool success = base.AttemptMove(move);
     *      if(success)
     *      {
     *              Debug.Log("Success!");
     *      }
     *      else
     *      {
     *              Debug.Log("Failed!");
     *      }
     *      return success;
     * }
     * //*/

    public override void Die()
    {
        if (Random.Range(0, 5) == 0)
        {
            SFXManager.PlayerVoice();
        }
        base.Die();
        Scores.total         += 100;
        Scores.enemiesKilled += 1;
        player.GetComponent <TurnManager>().shortenEnemyList();
    }
示例#3
0
    protected override bool AttemptMove(Move move)
    {
        if (move == lastMove)
        {
            combo++;
            //Debug.Log(combo + "x COMBO!");
        }
        else
        {
            lastMove = move;
            combo    = fullCombo / 4;
            //Debug.Log("Combo reset to " + combo);
        }
        fullCombo++;

        if (move == Move.Heal)
        {
            health += healAmount + (combo * healIncrease);
            //1 and 2 are 5 less than before; 3 is the same; 4 and higher are more.
            if (health > maxHealth)
            {
                health = maxHealth;
            }
            Instantiate(healingEffect, transform.position + new Vector3(0, 0, .5f), Quaternion.identity);
            return(true);
        }
        else
        {
            bool success = false;
            if (move == Move.Fight && combo > 2)
            {
                //Debug.Log("AoE triggered!");

                //play an obscenity

                //i.e. the fourth or later punch in a row
                List <Entity> closeEntities = GridManager.instance.getEntitiesInRect(x - 2, x + 2, y + 2, y - 2);

                foreach (Entity entity in closeEntities)
                {
                    if (entity != null)
                    {
                        if (entity.gameObject.tag == foeTag)
                        {
                            entity.takeDamage(10);

                            success = true;
                        }
                    }
                }


                animator.Play("AttackDown");
                shakyCam = shakeTime;
                Instantiate(aoeEffect, transform.position, Quaternion.identity);
                audioSources[2].volume = PlayerPrefs.GetFloat(InGameMenu.effectVolKey);
                audioSources[2].Play();

                if (Random.Range(0, 5) == 0)
                {
                    SFXManager.PlayerVoice();
                }
                return(success);
            }

            success = base.AttemptMove(move);
            if (success)
            {
                return(true);
            }
            //else

            if (move.isDirectional())
            {
                facing = move;

                //find the destination tile
                Vector2 moveDir = move.getDirection();
                int     destX   = x + (int)moveDir.x;
                int     destY   = y + (int)moveDir.y;

                Entity target = GridManager.instance.getTarget(destX, destY);

                if (target != null)
                {
                    if (target.gameObject.tag == foeTag)
                    {
                        //a fightable enemy!
                        //deal it some damage.

                        target.takeDamage(blunderDamage);
                        animator.Play("AttackLeft");

                        //Debug.Log("Player blunders into " + target.gameObject.name + ", dealing " + blunderDamage + " damage!  " + target.health + " health remains.");

                        target.currentRed = 100;

                        return(true);
                    }
                }

                return(false);
            }
            else if (move == Move.Fight && combo > 0)
            {
                //Debug.Log("Ranged attempt triggered");


                //try again with range.
                //copy of the normal fight code, because we need to know our target.
                //this is bad practice
                Vector2[] fightOrder = facing.attackOrder();
                for (int i = 0; i < 4; i++)
                {
                    for (int j = 1; j <= 2; j++)
                    {
                        Vector2 fightDir = fightOrder[i];
                        int     destX    = x + ((int)fightDir.x * j);
                        int     destY    = y + ((int)fightDir.y * j);

                        Entity target = GridManager.instance.getTarget(destX, destY);
                        if (target != null)
                        {
                            if (target.gameObject.tag == foeTag)
                            {
                                //play an obscenity IFF a bottle is actually thrown.


                                target.takeDamage(damageDealt);

                                facing = moveExtensions.getMove(fightOrder[i]);
                                animator.Play("AttackLeft");
                                //changing this to an actual bottle throwing animation would be nice
                                //but unlikely

                                Bottle proj = (Bottle)Instantiate(bottlePrefab, gameObject.transform.position + bottleOffset, Quaternion.identity);
                                proj.target_x = target.x;
                                proj.target_y = target.y;
                                if (Random.Range(0, 5) == 0)
                                {
                                    SFXManager.PlayerVoice();
                                }
                                return(true);
                            }
                        }
                    }
                }
            }

            return(false);
        }
    }