Esempio n. 1
0
        // TODO: I think this should be in Start
        private new void Awake()
        {
            base.Awake();
            worldObjectType = (WorldObjectType)entityType;

            timeManager            = GameObject.Find("TimeManager").GetComponent <TimeManager>();
            animator               = GetComponent <Animator>();
            completePoints         = startCompletePoints;
            currentState           = null;
            currentSkinPrefabIndex = -1;

            ResetEntity();
        }
Esempio n. 2
0
            public bool Check(WorldObject worldObject)
            {
                if (prefabVariantIndex != -1 && prefabVariantIndex != worldObject.prefabVariantIndex)
                {
                    return(false);
                }

                WorldObjectType worldObjectType = worldObject.worldObjectType;

                if (worldObjectType.completeType != CompleteType.None && minComplete != -1f && maxComplete != -1f &&
                    (worldObject.completePoints < minComplete || worldObject.completePoints > maxComplete))
                {
                    return(false);
                }

                if (worldObjectType.canBeDamaged && minDamage != -1f && maxDamage != -1f &&
                    (worldObject.damage < minDamage || worldObject.damage > maxDamage))
                {
                    return(false);
                }

                if (inventorySlotConditions != null && inventorySlotConditions.Count > 0)
                {
                    foreach (InventorySlotCondition inventorySlotCondition in inventorySlotConditions)
                    {
                        if (!inventorySlotCondition.Check(worldObject))
                        {
                            return(false);
                        }
                    }
                }

                if (states != null && states.Count > 0 && worldObject.currentState != null && !states.Contains(worldObject.currentState.name))
                {
                    return(false);
                }

                return(true);
            }