예제 #1
0
 //meant to be overwritten by specific item and still lacks
 //levels of abstraction. Might need to be redesigned to accomodate
 //items that Cast() can't
 public virtual void AffectNPC(NPCEmotions NPC)
 {
     NPC.AddPain(strength * painMod);
     NPC.AddFear(strength * fearMod);
     NPC.AddJoy(strength * joyMod);
     NPC.AddLaughter(strength * laughterMod);
 }
예제 #2
0
    void OnCollisionEnter(Collision col)
    {
        NPC = col.gameObject.GetComponent <NPCEmotions> ();

        strength = Mathf.Abs(Mathf.Max(rb.velocity.x, rb.velocity.y));

        audio.volume = (strength / 50);

        //hits a player
        if (NPC != null && justHit == false)
        {
            audio.clip = soundEffects [0];
            audio.Play();

            AffectNPC(NPC);
            justHit = true;
        }
        else if (col.transform.tag == "Surface" && justHit == false)             //hit something else

        {
            audio.clip = soundEffects [1];
            audio.Play();
            justHit = true;
        }
    }
예제 #3
0
 public override void AffectNPC(NPCEmotions NPC)
 {
     Debug.Log(strength);
     NPC.AddPain(strength);
     NPC.AddFear(strength / 2);
     NPC.AddJoy(-strength / 2);
     NPC.AddLaughter(-strength / 2);
 }
예제 #4
0
 public void SetEmotion(NPCEmotions newEmotion)
 {
     emotions = newEmotion;
     StartCoroutine(ShowEmotion());
 }
예제 #5
0
    //keeps from repeatedly hitting
    void OnCollisionExit(Collision col)
    {
        NPC = col.gameObject.GetComponent <NPCEmotions> ();

        justHit = false;
    }