Inheritance: MonoBehaviour
Ejemplo n.º 1
0
 void Start()
 {
     flame = GetComponentInChildren<Flamable>();
     if (flame == null)
     {
         Debug.Log("WARNING! THE FLAME COMPONENT IS NULL ON " + gameObject.name);
     }
 }
Ejemplo n.º 2
0
    void OnTriggerExit(Collider collider)
    {
        GrabbableObj obj = collider.attachedRigidbody.gameObject.GetComponent<GrabbableObj>();
        if (obj == objNearHand)
            objNearHand = null;

        Flamable fmb = collider.gameObject.GetComponent<Flamable>();
        if (fmb == fireNearHand)
        {
            fireNearHand = null;
        }
    }
Ejemplo n.º 3
0
 /// <summary>
 /// Use the object at position x, y on object obj
 /// </summary>
 /// <param name="posX">Position x.</param>
 /// <param name="posY">Position y.</param>
 /// <param name="obj">Object.</param>
 public override bool Use(float posX, float posY, GameObject obj = null)
 {
     if (obj != null)
     {
         Flamable flame = obj.GetComponent <Flamable> ();
         if (flame != null)
         {
             flame.SetOnFire();
             //Destroy (gameObject, 0.1f);
             return(true);
         }
     }
     //PlayerControl.playerControl.Unlcoked (1);
     return(false);
 }
Ejemplo n.º 4
0
    private void OnCollisionEnter(Collision collision)
    {
        if (!this.enabled)
        {
            return;
        }

        if (collision.collider.CompareTag("Flamable"))
        {
            flamable = collision.collider.gameObject.GetComponent <Flamable>();
            burned   = true;
        }
        if (collision.gameObject.name.Substring(0, 5) == "Arrow")
        {
            ArrowScript arrow = collision.gameObject.GetComponent <ArrowScript>();
            arrow.flaming = true;
        }
    }
Ejemplo n.º 5
0
    public void DestroyObject()
    {
        if (GetComponent <Flamable>())
        {
            Flamable component = GetComponent <Flamable>();
            component.FireBurnOut(false);
        }
        if (createdInScene)
        {
            DestroyObjectBuffered();
        }
        else
        {
            Destroy(gameObject);
        }

        if (GetComponent <Flamable>())
        {
            Flamable component = GetComponent <Flamable>();
            component.FireBurnOut(false);
        }
    }
Ejemplo n.º 6
0
    void DetermineIgniteOrExtinguish(GameObject col)
    {
        if (col.GetComponent <Substance>() != null && col.GetComponent <Substance>().isWater())
        {
            if (Extinguished != null)
            {
                Extinguished(this.gameObject);
            }

            Extinguish();
        }
        if (col.GetComponent("Flamable") == null)
        {
            return;
        }

        Flamable other_flamable = col.GetComponent("Flamable") as Flamable;

        if (other_flamable.isIgnited())
        {
            Ignite();
        }
    }
Ejemplo n.º 7
0
 void OnTriggerEnter(Collider collider)
 {
     //DebugConsole.dc.AddLine("OnTriggerEnterCalled");
     GrabbableObj obj = collider.attachedRigidbody.gameObject.GetComponent<GrabbableObj>();
     if (obj != null && joint == null)// && device.GetTouchDown(SteamVR_Controller.ButtonMask.Trigger))
     {
         objNearHand = obj;
         /*if (obj.shouldSnap)
         {
             obj.rb.position = attachPoint.position;
             obj.rb.rotation = attachPoint.rotation;
         }
         //DebugConsole.dc.AddLine("Should have grabbed");
         joint = gameObject.AddComponent<FixedJoint>();
         joint.connectedBody = obj.rb;
         obj.OnGrab();*/
     }
     Flamable fmb = collider.gameObject.GetComponent<Flamable>();
     if (fmb != null)
     {
         fireNearHand = fmb;
     }
 }