Skip to content

Commit

Permalink
Added a draft of CHALET unity3d code.
Browse files Browse the repository at this point in the history
  • Loading branch information
Dipendra Misra authored and Dipendra Misra committed Oct 11, 2018
1 parent 4c33276 commit 81ba61e
Show file tree
Hide file tree
Showing 1,212 changed files with 108,155 additions and 0 deletions.
Binary file added src/.DS_Store
Binary file not shown.
Binary file added src/Assets/.DS_Store
Binary file not shown.
9 changes: 9 additions & 0 deletions src/Assets/Editor.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

74 changes: 74 additions & 0 deletions src/Assets/Editor/BedroomDrawerColliders.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
using UnityEngine;
using UnityEditor;

public class BedroomDrawerColliders : EditorWindow {

[MenuItem("Tools/BedroomDrawerColliders")]
static void BedroomColliders()
{
GameObject[] gobjects = Selection.gameObjects;
foreach (GameObject go in gobjects)
{
try
{
BoxCollider[] bcs = go.GetComponents<BoxCollider>();
foreach (BoxCollider bc in bcs)
{
DestroyImmediate(bc);
}
}

catch
{
Debug.LogFormat("No colliders found in {0}", go.name);
}


BoxCollider outerBC = go.AddComponent<BoxCollider>();
BoxCollider triggerBC = go.AddComponent<BoxCollider>();

outerBC.center = new Vector3(0f, .12f, -.05f);
outerBC.size = new Vector3(1.178f, .218f, .04f);
outerBC.isTrigger = false;

triggerBC.center = new Vector3(0f, .0236f, -.018f);
triggerBC.size = new Vector3(1.178f, .047f, .987f);
triggerBC.isTrigger = true;


try
{
BoxCollider[] childColliders = go.GetComponentsInChildren<BoxCollider>(true);
foreach (BoxCollider child in childColliders)
{
if (child.gameObject.name == "collider" || child.gameObject.name == "Collider" || child.gameObject.name.Contains("1"))
{
child.gameObject.SetActive(true);
}

else if (child.gameObject.name != "collider" && child.gameObject.name.Contains("collider"))
{
child.gameObject.SetActive(false);
}

}

}
catch
{
Debug.LogFormat("Theres no child colliders in {0}", go.name);
}


try
{
MeshCollider uselessMesh = go.GetComponent<MeshCollider>();
DestroyImmediate(uselessMesh);
}
catch
{

}
}
}
}
12 changes: 12 additions & 0 deletions src/Assets/Editor/BedroomDrawerColliders.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions src/Assets/Editor/CrossPlatformInput.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

142 changes: 142 additions & 0 deletions src/Assets/Editor/CrossPlatformInput/CrossPlatformInputInitialize.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
using System;
using System.Collections.Generic;
using UnityEditor;

namespace UnityStandardAssets.CrossPlatformInput.Inspector
{
[InitializeOnLoad]
public class CrossPlatformInitialize
{
// Custom compiler defines:
//
// CROSS_PLATFORM_INPUT : denotes that cross platform input package exists, so that other packages can use their CrossPlatformInput functions.
// EDITOR_MOBILE_INPUT : denotes that mobile input should be used in editor, if a mobile build target is selected. (i.e. using Unity Remote app).
// MOBILE_INPUT : denotes that mobile input should be used right now!

static CrossPlatformInitialize()
{
var defines = GetDefinesList(buildTargetGroups[0]);
if (!defines.Contains("CROSS_PLATFORM_INPUT"))
{
SetEnabled("CROSS_PLATFORM_INPUT", true, false);
SetEnabled("MOBILE_INPUT", true, true);
}
}


[MenuItem("Mobile Input/Enable")]
private static void Enable()
{
SetEnabled("MOBILE_INPUT", true, true);
switch (EditorUserBuildSettings.activeBuildTarget)
{
case BuildTarget.Android:
case BuildTarget.iOS:
case BuildTarget.WP8Player:
case BuildTarget.PSM:
case BuildTarget.WSAPlayer:
EditorUtility.DisplayDialog("Mobile Input",
"You have enabled Mobile Input. You'll need to use the Unity Remote app on a connected device to control your game in the Editor.",
"OK");
break;

default:
EditorUtility.DisplayDialog("Mobile Input",
"You have enabled Mobile Input, but you have a non-mobile build target selected in your build settings. The mobile control rigs won't be active or visible on-screen until you switch the build target to a mobile platform.",
"OK");
break;
}
}


[MenuItem("Mobile Input/Enable", true)]
private static bool EnableValidate()
{
var defines = GetDefinesList(mobileBuildTargetGroups[0]);
return !defines.Contains("MOBILE_INPUT");
}


[MenuItem("Mobile Input/Disable")]
private static void Disable()
{
SetEnabled("MOBILE_INPUT", false, true);
switch (EditorUserBuildSettings.activeBuildTarget)
{
case BuildTarget.Android:
case BuildTarget.iOS:
case BuildTarget.WP8Player:
EditorUtility.DisplayDialog("Mobile Input",
"You have disabled Mobile Input. Mobile control rigs won't be visible, and the Cross Platform Input functions will always return standalone controls.",
"OK");
break;
}
}


[MenuItem("Mobile Input/Disable", true)]
private static bool DisableValidate()
{
var defines = GetDefinesList(mobileBuildTargetGroups[0]);
return defines.Contains("MOBILE_INPUT");
}


private static BuildTargetGroup[] buildTargetGroups = new BuildTargetGroup[]
{
BuildTargetGroup.Standalone,
BuildTargetGroup.WebGL,
BuildTargetGroup.Android,
BuildTargetGroup.iOS,
BuildTargetGroup.WSA
};

private static BuildTargetGroup[] mobileBuildTargetGroups = new BuildTargetGroup[]
{
BuildTargetGroup.Android,
BuildTargetGroup.iOS,
BuildTargetGroup.WSA,
BuildTargetGroup.PSM,
BuildTargetGroup.SamsungTV,
BuildTargetGroup.Tizen,
BuildTargetGroup.WSA
};


private static void SetEnabled(string defineName, bool enable, bool mobile)
{
//Debug.Log("setting "+defineName+" to "+enable);
foreach (var group in mobile ? mobileBuildTargetGroups : buildTargetGroups)
{
var defines = GetDefinesList(group);
if (enable)
{
if (defines.Contains(defineName))
{
return;
}
defines.Add(defineName);
}
else
{
if (!defines.Contains(defineName))
{
return;
}
while (defines.Contains(defineName))
{
defines.Remove(defineName);
}
}
string definesString = string.Join(";", defines.ToArray());
PlayerSettings.SetScriptingDefineSymbolsForGroup(group, definesString);
}
}


private static List<string> GetDefinesList(BuildTargetGroup group)
{
return new List<string>(PlayerSettings.GetScriptingDefineSymbolsForGroup(group).Split(';'));
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

52 changes: 52 additions & 0 deletions src/Assets/Editor/GetChildren.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
using UnityEngine;
using System.Collections;
using UnityEditor;
using System.Collections.Generic;
using System.IO;


public class GetChildren : MonoBehaviour {
private IList<Transform> listOfTransforms;
private IList<GameObject> listofPrefabs = new List<GameObject>();
private const string prefabStr = "PRE_";

void Start()
{
Debug.Log("Start");
listOfTransforms = gameObject.GetComponentsInChildren<Transform>();
Debug.Log("pls");
foreach(Transform obj in listOfTransforms)
{
if (obj.name.Contains(prefabStr))
{
var objName = obj.name;
Debug.Log(objName);
listofPrefabs.Add(obj.gameObject);
}
}
foreach (GameObject go in listofPrefabs)
{
Debug.Log(go.name);
//var prefabName = go.name + ".prefab";
foreach(string s in AssetDatabase.GetAllAssetPaths())
{
if (s.Contains(go.name) && s.Contains("Complete_Home_Interior_Pack"))
Debug.Log(s);

}


//Debug.Log(Path.Combine(Directory.GetCurrentDirectory(), fileName));

}

}


}






12 changes: 12 additions & 0 deletions src/Assets/Editor/GetChildren.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

53 changes: 53 additions & 0 deletions src/Assets/Editor/GiveMeshCollider.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
using UnityEngine;
using UnityEditor;
using Cyan;

public class GiveMeshCollider : EditorWindow {

[MenuItem("Tools/Set with Drawer Settings")]
static void GiveMesh()
{
GameObject[] gobjects = Selection.gameObjects;

foreach(GameObject go in gobjects)
{
try
{
BoxCollider bc = go.GetComponent<BoxCollider>();
bc.enabled = true;
bc.isTrigger = true;
Debug.LogFormat("Enabled Box Colldier on {0}", go.name);
}
catch
{
BoxCollider bc = go.AddComponent<BoxCollider>();
bc.isTrigger = true;
Debug.LogFormat("Added Box Collider on {0}", go.name);
}
try
{
MeshCollider mC = go.GetComponent<MeshCollider>();
mC.enabled = false;
Debug.LogFormat("Found MeshCollider {0}", mC.ToString());
}
catch
{
Debug.Log("Did not have mesh collider");

}
try
{
MoveWithDrawer mWD = go.GetComponent<MoveWithDrawer>();
Debug.LogFormat("Found move with drawer script in {0},{1}", mWD.ToString(), go.name);
}
catch
{
MoveWithDrawer mWS = go.AddComponent<MoveWithDrawer>();
Debug.LogFormat("Added Move with Drawer script {0}", mWS.ToString());
}
}

Debug.LogFormat("Updated {0} objects with Drawer Functionality", gobjects.Length);
}

}
12 changes: 12 additions & 0 deletions src/Assets/Editor/GiveMeshCollider.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 81ba61e

Please sign in to comment.