DeathBook/Assets/Scripts/Models/Friendship.cs
RosimInc 9d06c3fe30 Started implementing game time, player awareness update after death.
Signed-off-by: RosimInc <rosim_inc@hotmail.com>
2015-08-14 18:51:31 -04:00

54 lines
1.2 KiB
C#

using System;
using System.Collections.Generic;
using UnityEngine;
using DeathBook.Util;
namespace DeathBook.Model
{
public class Friendship : Observable, Updatable
{
private Person self;
public Person Self { get { return self; } }
private Person friend;
public Person Friend { get { return friend; } }
private Friendship other;
public Friendship Other { get { return other; } set { other = value; } }
private FriendshipLink link;
public FriendshipLink Link { get { return link; } }
private float awareness = 0; //on a scale from 0 to 1
public float Awareness { get { return awareness; } }
public Friendship(Person self, Person friend)
{
this.self = self;
this.friend = friend;
}
public void Update(float deltaTime)
{
//This function is only called when friend is dead
awareness = Mathf.Max(awareness + deltaTime * CalculateWeight(), 100);
NotifyObservers();
}
//returns a number between 0 and 1
private float CalculateWeight()
{
float weight = 0;
weight += link.Importance;
return weight;
}
internal enum Knowledge
{
Alive, Doubt, Dead
}
}
}