示例#1
0
 protected override bool TryAddObject(Takable gameObject, Interactror interactror)
 {
     if (containedObjects.Count != 0)
     {
         return(TryCraft(gameObject));
     }
     gameObject.transform.position = depotSpot.position;
     gameObject.transform.rotation = depotSpot.rotation;
     return(true);
 }
示例#2
0
    /// <summary>
    /// DO NOT OVERRIDE THIS METHOD
    /// Adds a GameObject to the object container
    /// </summary>
    /// <param name="gameObject"></param>
    public bool PutObject(Takable interactee, Interactror interactror)
    {
        if (TryAddObject(interactee, interactror))
        {
            Debug.Log("Object ADDED to container!");
            containedObjects.Add(interactee);
            return(true);
        }

        return(false);
    }
示例#3
0
    protected override void OnInteractionImpl(Interactror interactror)
    {
        if (currentTime > 0 && !AnalyzeFinished)
        {
            Debug.LogError("CANCELING TIMER!");
            currentTime          = 0;
            progressBar.Progress = 0;
            interactror.heldObject.GetComponent <Analyzable>().OnAnalyzeCancelled();
            typingSound.Stop();
        }

        if (!ContainsObject)
        {
            progressionUI.SetActive(false);
            Destroy(RecipeResult.GetComponent <Text>());
        }
        AnalyzeFinished = false;
    }
示例#4
0
    protected override bool TryAddObject(Takable gameObject, Interactror interactror)
    {
        // Verify if this is the correct script
        // In this case, it the the clien't computer and are all the requirements met
        if (gameObject == computer.takable && computer.requirements.Count == 0)
        {
            Destroy(computer.gameObject);
            MakeCustomerLeave();

            var moneyManager = FindObjectOfType <MoneyManager>();

            if (moneyManager != null)
            {
                moneyManager.CompleteOrder();
            }

            return(true);
        }
        return(false);
    }
示例#5
0
    public sealed override void OnInteraction(Interactror interactror)
    {
        if (interactror.IsHoldingObject && interactror.heldObject != this)
        {
            interactror.heldObject.OnInteraction(interactror);
            return;
        }
        isPickedUp = !isPickedUp;

        if (isPickedUp)
        {
            Debug.Log("I got picked up!");
            transform.position = interactror.Hands.position;
            transform.rotation = interactror.Hands.rotation;
        }

        transform.parent       = isPickedUp ? interactror.Hands : null;
        interactror.heldObject = isPickedUp ? this : null;

        UpdateComponentStatus();
    }
示例#6
0
    protected override bool TryAddObject(Takable gameObject, Interactror interactor)
    {
        if (!gameObject.TryGetComponent <Analyzable>(out var analyzable))
        {
            Debug.LogError("Object is not Analyzable!");
            return(false);
        }

        if (containedObjects.Count == 1)
        {
            Debug.Log("There is already an object in the Analyzer!");
            return(false);
        }

        progressBar.Progress = 0;
        progressionUI.SetActive(true);
        analyzable.OnAnalyze(this, interactor);
        typingSound.Play();
        gameObject.transform.position = depotSpot.position;
        gameObject.transform.rotation = depotSpot.rotation;

        return(true);
    }
示例#7
0
 public sealed override void OnInteraction(Interactror interactror)
 {
     if (interactror.IsHoldingObject)
     {
         if (PutObject(interactror.heldObject, interactror))
         {
             interactror.heldObject.transform.parent = transform;
             interactror.heldObject = null;
             OnInteractionImpl(interactror);
             PostPutHook();
         }
     }
     else
     {
         if (containedObjects.Count != 0)
         {
             interactror.heldObject = containedObjects[containedObjects.Count - 1];
             containedObjects.RemoveAt(containedObjects.Count - 1);
             interactror.heldObject.transform.position = interactror.Hands.position;
             interactror.heldObject.transform.parent   = interactror.Hands;
             OnInteractionImpl(interactror);
         }
     }
 }
示例#8
0
 protected virtual void OnInteractionImpl(Interactror interactror)
 {
 }
示例#9
0
 protected abstract bool TryAddObject(Takable gameObject, Interactror interactror);
示例#10
0
 private void UnfreezePlayer()
 {
     analyzedBy.GetComponent <Character>().Freezed = false;
     analyzedBy = null;
 }
示例#11
0
 public void OnAnalyze(RepairObjectAnalyzer analyzer, Interactror interactror)
 {
     analyzedBy = interactror;
     interactror.GetComponent <Character>().Freezed = true;
 }
示例#12
0
 public override void OnInteraction(Interactror interactror)
 {
     _anim.SetTrigger("Order");
     _truckThrower.ThrowBox(boxPrefab.GetComponent <Rigidbody>()).GetComponent <DeliveryboxBehaviour>().content = content;
 }
示例#13
0
 /// <summary>
 /// Gets called when an Interactor tries to interact with the current interactee
 /// </summary>
 /// <param name="interactror">The interactor that is trying to interact with us</param>
 /// <returns>Whether the interaction "succeeded" (a.k.a , am I holding the object or not)</returns>
 public abstract void OnInteraction(Interactror interactror);