internal StatResult GetStatFunctionResult(StatFunction statFunction, DataGridCollectionView view)
        {
            StatResult result;

            if (!m_statFunctionValues.TryGetValue(statFunction, out result))
            {
                result = null;
                m_statFunctionValues[statFunction] = result;
            }

            return(result);
        }
    public virtual BaseCharacter Init(int groupHandle, float agentDensity, Stat baseStat, BaseState idle, BaseState attack, BaseState move, BaseState death, BaseState chase = null)
    {
        m_animator = GetComponent <Animator>();

        m_stateMethodDic.Add(ECharacterState.Idle, idle);
        m_stateMethodDic.Add(ECharacterState.Attack, attack);
        m_stateMethodDic.Add(ECharacterState.Move, move);
        m_stateMethodDic.Add(ECharacterState.Death, death);

        m_agroCollider           = gameObject.AddComponent <CircleCollider2D>();
        m_agroCollider.radius    = 3;
        m_agroCollider.isTrigger = true;

        m_stat  = new StatFunction(baseStat);
        m_agent = new FlockingAgent(this, groupHandle, agentDensity);
        CharacterMng.Instance.AddGroupMember(groupHandle, this);

        m_astarAgent = gameObject.AddComponent <AStarAgent>();

        return(this);
    }
        internal object GetStatFunctionValue(string propertyName)
        {
            DataGridCollectionView view = this.GetCollectionView();

            Debug.Assert(view != null);

            if (view == null)
            {
                return(null);
            }

            StatFunction statFunction = view.StatFunctions[propertyName];

            Debug.Assert(view != null);

            if (statFunction == null)
            {
                return(null);
            }

            return(this.GetStatFunctionResult(statFunction, view).Value);
        }
Exemple #4
0
        public UserStat UpdateStats(string id, StatFunction func, int xp = 0)
        {
            var stat = _context.UserStats.Find(id);

            if (func == StatFunction.Cancellation)
            {
                stat.NumOfCancelled++;
            }
            else if (func == StatFunction.Creation)
            {
                stat.NumOfBets++;
            }
            else if (func == StatFunction.Referee)
            {
                stat.NumOfReferreed++;
            }
            else if (func == StatFunction.Win)
            {
                stat.NumOfWins++;
            }
            else if (func == StatFunction.Loss)
            {
                stat.NumOfLosses++;
            }
            else if (func == StatFunction.Draw)
            {
                stat.NumOfDraws++;
            }
            else if (func == StatFunction.XP)
            {
                // xp ???
            }

            _context.UserStats.Update(stat);
            _context.SaveChanges();

            return(stat);
        }
Exemple #5
0
 public ItemStatGenerator(StatFunction lowStatFunction, StatFunction highStatFunction, StatType type)
 {
     LowStatFunction  = lowStatFunction;
     HighStatFunction = highStatFunction;
     Type             = type;
 }