Inheritance: MonoBehaviour
コード例 #1
0
ファイル: FlameSwitch.cs プロジェクト: Evellex/Eldrinth
 void Start()
 {
     flame = GetComponentInChildren<Flamable>();
     if (flame == null)
     {
         Debug.Log("WARNING! THE FLAME COMPONENT IS NULL ON " + gameObject.name);
     }
 }
コード例 #2
0
ファイル: Grabbers.cs プロジェクト: Evellex/Eldrinth
    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;
        }
    }
コード例 #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);
 }
コード例 #4
0
ファイル: Fire.cs プロジェクト: leo-beal/JungleTeam
    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;
        }
    }
コード例 #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);
        }
    }
コード例 #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();
        }
    }
コード例 #7
0
ファイル: Grabbers.cs プロジェクト: Evellex/Eldrinth
 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;
     }
 }