Ejemplo n.º 1
0
    public void RandomInit()
    {
        Attributes = new NeedsAttributes();
        Attributes.Randomize();

        ApplyAttributesToMaterial();
    }
Ejemplo n.º 2
0
    public void AssignRandomNeeds()
    {
        if (patronHolding?.gameObject != null)
        {
            Destroy(patronHolding.gameObject);
        }

        var lostItem = Main.Instance.GetRandomSpawnedEntity()?.GetComponent <LostItemEntity>();

        Needs = lostItem?.Attributes;

        patronHands.GetComponent <ItemHinting>().Init(lostItem);
    }
Ejemplo n.º 3
0
    void Start()
    {
        // lazy
        Instance = this;

        // Initialize game wide rng
        Rand = new Random();



        // Load Resources
        _LostItemTextures = LoadAllResourcesAtPathOfType <Texture2D>("ItemTextures");
        _LostItemColors   = LoadAllResourcesAtPathOfType <AttributeColorWrapper>("ItemColors");
        _LostItemMeshes   = LoadAllResourcesAtPathOfType <SpawnedEntity>("ItemMeshes");

        // Initialize asset enum maps
        // This must be done after resources are loaded
        NeedsAttributes.SetEnumAttributeMaps();
    }
Ejemplo n.º 4
0
    public override void ForceSpawn()
    {
        var attributes = new NeedsAttributes();

        attributes.Randomize();

        attributes.Model = AllowedMeshes[Main.Instance.Rand.Next(AllowedMeshes.Length)];
        var model = attributes.GetModel();

        var entity = Instantiate(model, GetNextSpawnLocation(), Quaternion.Euler(ForcedRotation));

        var lostItem = entity.GetComponent <LostItemEntity>();

        lostItem.Attributes = attributes;
        lostItem.ApplyAttributesToMaterial();

        lostItem.DestroyCallback += OnSpawnedDestroyed;
        lostItem.tag              = "Item";

        SpawnedEntities.Add(entity);
    }