protected virtual void Greet(FactionMember other)
        {
            if (m_self == null || other == null || other == m_self || m_animator == null)
            {
                return;
            }
            lastGreeting[other] = GameTime.time;
            var affinity = m_self.GetAffinity(other);

            for (int g = 0; g < greetings.Length; g++)
            {
                var greeting = greetings[g];
                var isAppropriateGreeting = (greeting.min <= affinity && affinity <= greeting.max) &&
                                            ((greeting.temperament & m_self.pad.GetTemperament()) != 0);
                if (isAppropriateGreeting)
                {
                    if (!string.IsNullOrEmpty(greeting.triggerParameter))
                    {
                        m_animator.SetTrigger(greeting.triggerParameter);
                    }
                    break;
                }
            }
            ExecuteEvents.Execute <IGreetEventHandler>(m_self.gameObject, null, (x, y) => x.OnGreet(other));
        }
Exemple #2
0
        protected virtual bool ShouldGossip(FactionMember other)
        {
            if (m_self == null || other == null || other == m_self ||
                other.factionID == FactionDatabase.PlayerFactionID || other.CompareTag("Player"))
            {
                return(false);
            }
            var tooRecent = lastGossip.ContainsKey(other) && (GameTime.time < (lastGossip[other] + timeBetweenGossip));

            return(!tooRecent && (m_self.GetAffinity(other) > 0));
        }