コード例 #1
0
ファイル: DisableSphere.cs プロジェクト: dpklinge/CubeGame
 private void OnTriggerExit(Collider other)
 {
     Debug.Log(other.name+ " exited disableShere trigger");
     CubeType cube = other.GetComponentInChildren<CubeType>();
     if (cube != null)
     {
         cube.TurnOn();
     }
 }
コード例 #2
0
    public override void DisableBehaviour(string disableType)
    {
        Debug.Log("Disabling behaviour generic box; Setting kinematic to true");
        this.gameObject.GetComponent <Rigidbody>().isKinematic = true;
        float radius = radiusMultiplier * gameObject.transform.localScale.magnitude;

        Collider[] colliders = Physics.OverlapSphere(gameObject.transform.position, radius);
        foreach (Collider collider in colliders)
        {
            CubeType cube = collider.gameObject.GetComponent <CubeType>();
            if (cube != null && cube.gameObject != gameObject)
            {
                cube.TurnOn();
            }
        }
        GameObject.Destroy(disableSphereInstance);
        base.DisableBehaviour(disableType);
    }