// Use this for initialization
 void Start()
 {
     body = GetComponent<Rigidbody> ();
     agent = GetComponent<NavMeshAgent> ();
     if (body != null) {
         body.Sleep ();
     }
 }
 static public int Sleep(IntPtr l)
 {
     try {
         UnityEngine.Rigidbody self = (UnityEngine.Rigidbody)checkSelf(l);
         self.Sleep();
         return(0);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemple #3
0
 static public int Sleep(IntPtr l)
 {
     try {
         UnityEngine.Rigidbody self = (UnityEngine.Rigidbody)checkSelf(l);
         self.Sleep();
         return(0);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
Exemple #4
0
    private int moving = 0; // -1 for left, 1 for right


    void Awake () {
        rb = GetComponent<Rigidbody>();
        rb.Sleep();
        boulder.Sleep();
        startPos = transform.position;
        startRot = transform.rotation;
        startTransPos = objectTransform.position;
        boulderStartPos = boulder.transform.position;
        groundStartPos = ground.position;
        prevGroundPos = ground.position;

        anim = transform.GetComponentInParent<Animator>();
    }
Exemple #5
0
 static int Sleep(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         UnityEngine.Rigidbody obj = (UnityEngine.Rigidbody)ToLua.CheckObject(L, 1, typeof(UnityEngine.Rigidbody));
         obj.Sleep();
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Exemple #6
0
 // Use this for initialization
 void Start()
 {
     rigidBody = this.gameObject.GetComponent<Rigidbody>();
     rigidBody.Sleep();
 }
Exemple #7
0
    protected virtual void Awake()
    {
        //grab component references
        _transform = transform;
        _gameObject = gameObject;
        _renderer = renderer;
        _collider = collider;
        _rigidbody = rigidbody;
        _instanceID = gameObject.GetInstanceID();

        //calculate the update interval (assuming ideal target of 60 fps)
        _updateInterval = UpdatesPerSecond / 60f;

        //check conditions
        if (_rigidbody != null && !RigidBodyAwakeOnStart) { _rigidbody.Sleep(); }
        if (!GameObjectActiveOnStart) { _gameObject.active = false; }

        //start coroutines
        if (_renderer != null) { StartCoroutine( CheckIsHidden() ); }
    }
Exemple #8
0
	private void Awake()
	{
		auxRigidbody = transform.GetComponent<Rigidbody>();
		
		if (RigidbodySleepOnAwake)
		{
			auxRigidbody.Sleep();
		}

        // Initialize values
        NitroLeft = NitroInitialAmount;

        if (CenterOfMass != null)
        {
            GetComponent<Rigidbody>().centerOfMass = CenterOfMass.localPosition;
        }

        if (WheelBase != null)
        {
            WheelBase.localPosition = new Vector3(0, WheelBaseAlignment);
        }

        if (SkidmarkObjectName != "")
        {
            if (GameObject.Find(SkidmarkObjectName))
            {
                SkidMarks = GameObject.Find(SkidmarkObjectName);
                Debug.Log(SkidMarks.name);
            }
        }

        if (CarInteria < 0.01f)
        {
            CarInteria = 0.01f;
        }

        GetComponent<Rigidbody>().inertiaTensor *= CarInteria;

        updateVehicleConfig();

        NosFireObject.SetActive(false);
    }
 // The AoE effect on game objects
 protected override void AoEHit(Rigidbody obj)
 {
     obj.velocity = Vector3.zero;
     obj.Sleep();
 }