public void Despawn(BaseCorrupter corrupter)
    {
        corrupters[corrupter.CorrupterID].Remove(corrupter);

        if (corrupter.CorrupterID == (int)CorrupterType.Officer)
        {
            if (GetCorrupterByID((int)CorrupterType.Officer).Count <= 0)
            {
                SetAllActiveCollider(CorrupterType.Police, true);
            }
        }
        CheckServivedTheLawsuit();
    }
示例#2
0
    private BaseCorrupter GetCorrupterFromPool(BaseCorrupter corrupterObj)
    {
        if (!CorrupterPools.ContainsKey(corrupterObj))
        {
            CorrupterPools.Add(corrupterObj, new List <BaseCorrupter>());
        }

        foreach (var corrupter in CorrupterPools[corrupterObj])
        {
            if (!corrupter.gameObject.activeInHierarchy)
            {
                return(corrupter);
            }
        }

        BaseCorrupter newCorrupter = Instantiate(corrupterObj).GetComponent <BaseCorrupter>() as BaseCorrupter;

        newCorrupter.transform.parent = this.transform;
        CorrupterPools[corrupterObj].Add(newCorrupter);
        return(newCorrupter);
    }