Exemplo n.º 1
0
    private void Awake()
    {
        renderer  = GetComponentInChildren <MeshRenderer>();
        rigidBody = GetComponent <Rigidbody>();
        entrance  = GetComponentInChildren <ShellEntrance>();
        light     = GetComponentInChildren <Light>();
        entrance.Init(this);
        decorations          = GetComponentsInChildren <PickupSlot>().ToList();
        transform.localScale = new Vector3(size, size, size);
        pickupPrefab         = Resources.Load <Pickup>("Pickups/Pickup");
        StartCoroutine(PulseLight());

        int i = 0;

        foreach (PickupSlot slot in decorations)
        {
            i++;
            if (i > decorations.Count / 2)
            {
                continue;
            }
            Pickup pickup = Instantiate(pickupPrefab, slot.transform.position, slot.transform.rotation);
            pickup.Init(DecorationType.Barny);
            pickup.OnAttachToShell();
            AttachPickup(pickup);
        }
    }