Example #1
0
        public override void DoInteraction()
        {
            Coffin.layer = LayerMaskManager.Get(Layer.DrawFront);
            MarkableComponent m = Coffin.GetComponent <MarkableComponent>();

            if (m != null)
            {
                m.enabled = false;
            }
            else
            {
                DebugMsg.ComponentNotFound(Debug.LogWarning, typeof(MarkableComponent));
            }
            AudioController.GetInstance().PlayPickupCoffin();
            Player.GetInstance().CurrentState = new DragCoffinState(Coffin);
        }
 public DriveCartInteraction(GameObject cart)
 {
     _cart = cart;
     foreach (Transform t in cart.GetComponentInChildren <Transform>())
     {
         if (t.gameObject.name == "Visuals")
         {
             _model = t.gameObject;
             break;
         }
     }
     _mark = cart.GetComponent <MarkableComponent>();
     if (_mark == null)
     {
         DebugMsg.ComponentNotFound(Debug.LogWarning, typeof(MarkableComponent));
     }
 }
        public override void DoInteraction()
        {
            _coffin.transform.parent = null;
            _coffin.GetComponent <Collider>().enabled = true;
            Rigidbody rb = _coffin.GetComponent <Rigidbody>();

            rb.isKinematic = false;
            _coffin.layer  = LayerMaskManager.Get(Layer.Landmark);

            MarkableComponent m = _coffin.GetComponent <MarkableComponent>();

            if (m == null)
            {
                Debug.LogWarning("Object <b>" + _coffin.gameObject.name + "</b> could not be marked. (Missing MarkableComponent!)");                 // TODO extract to Error class
            }
            else
            {
                //TODO: ADD GUARD -> enable only if not throwed into a hole
                m.enabled = true;
            }

            AudioController.GetInstance().PlayThrowCoffin();
            Player.GetInstance().CurrentState = new WalkRunState();
        }