예제 #1
0
    private void RemoveWallSlot(Collider2D collider)
    {
        WallSlot wallSlot = collider.GetComponentInParent <WallSlot>();

        if (wallSlot != null &&
            wallSlotsInRange.Contains(wallSlot))
        {
            wallSlotsInRange.Remove(wallSlot);
        }
    }
예제 #2
0
    private void AddWallSlot(Collider2D collider)
    {
        WallSlot wallSlot = collider.GetComponentInParent <WallSlot>();

        if (wallSlot != null &&
            !wallSlotsInRange.Contains(wallSlot))
        {
#if DEBUG_INTERACTION
            UnityEngine.Debug.Log("Add wall slot");
#endif
            wallSlotsInRange.Add(wallSlot);
        }
    }
예제 #3
0
    private void BuildWall(WallSlot wallSlot, Pickable pickable)
    {
        if (wallSlot.GetType() == typeof(SpecialSlot))
        {
            if ((wallSlot as SpecialSlot).AcceptedResource != pickable.ResourceType)
            {
                return;
            }
        }


#if DEBUG_INTERACTION
        UnityEngine.Debug.Log("Install in wall");
#endif
        currentInteractionDuration += Time.deltaTime;
        ChangeInteractionProgress(currentInteractionDuration / wallSlot.TimeToInteract);

        if (wallSlot.GetType() == typeof(SpecialSlot))
        {
            ChangeInteractionLabel("Decorating...");
        }
        else
        {
            ChangeInteractionLabel("Building Wall...");
        }

        //UnityEngine.Debug.Log((pickable.BuildSound != null));
        if (pickable.BuildSound != null)
        {
            interactionLoop.clip = pickable.BuildSound;
            //UnityEngine.Debug.Log(interactionLoop.clip.name);
            interactionLoop.volume = 1f;
            if (!interactionLoop.isPlaying)
            {
                interactionLoop.Play();
            }
        }


        if (currentInteractionDuration >= wallSlot.TimeToInteract)
        {
            RemoveFromInventory(pickable);

            wallSlot.BuildWall(pickable);

            GameObject.Destroy(pickable.gameObject);

            FinishInteraction();
        }
    }
예제 #4
0
 public void SubscribeWallSlot(WallSlot wallSlot)
 {
     Waves.WallSlots.Add(wallSlot);
 }