private void Awake() { //Make sure the scale is uniform, since otherwise lossy scale will not be accurate. float x = transform.localScale.x; float y = transform.localScale.y; float z = transform.localScale.z; if (Mathf.Abs(x - y) > float.Epsilon || Mathf.Abs(x - z) > float.Epsilon || Mathf.Abs(y - z) > float.Epsilon) { Debug.LogWarning("The xyz scales of the Spider are not equal. Please make sure they are. The scale of the spider is defaulted to be the Y scale and a lot of values depend on this scale."); } rb = GetComponent <Rigidbody>(); //Initialize the two Sphere Casts downRayRadius = downRaySize * getColliderRadius(); float forwardRayRadius = forwardRaySize * getColliderRadius(); downRay = new SphereCast(transform.position, -transform.up, downRayLength * getColliderLength(), downRayRadius, transform, transform); forwardRay = new SphereCast(transform.position, transform.forward, forwardRayLength * getColliderLength(), forwardRayRadius, transform, transform); //Initialize the bodyupLocal as the spiders transform.up parented to the body. Initialize the breathePivot as the body position parented to the spider bodyY = body.transform.InverseTransformDirection(transform.up); bodyZ = body.transform.InverseTransformDirection(transform.forward); bodyCentroid = body.transform.position + getScale() * bodyOffsetHeight * transform.up; bodyDefaultCentroid = transform.InverseTransformPoint(bodyCentroid); }
public void init() { player = GameObject.FindGameObjectWithTag("Player"); spawm = GameObject.FindGameObjectWithTag("Spawner"); sphereCast = player.GetComponent <SphereCast>(); handleTextFile = spawm.GetComponent <HandleTextFile>(); }
void Start() { objRend = new List <Renderer>(); enemyList = new List <GameObject>(); sphereCast = new SphereCast(); player = GameObject.FindGameObjectWithTag("Player"); spawns = GameObject.FindGameObjectsWithTag("Spawner").ToList(); sphereCast = player.GetComponent <SphereCast>(); //enemyRender = GameObject.FindGameObjectWithTag("Inimigo"); //objMesh = GameObject.FindGameObjectWithTag("HideObj"); //objRend = objMesh.GetComponent<Renderer>(); //obsList = GameObject.FindGameObjectsWithTag("Toten").ToList(); enemyList = GameObject.FindGameObjectsWithTag("Inimigo").ToList(); totenRend = GetComponent <Renderer>(); totenRend.material.shader = Shader.Find("Toon/Lit Dissolve DoubleTex"); shaderController = player.GetComponent <ShaderController>(); for (int i = 0; i < spawns.Count; i++) { handText = spawns[i].GetComponent <HandleTextFile>(); } //if (SaveLoadGame.instance.deuLoad == true) //{ // obsList[tottenAtual].GetComponent<Renderer>().material = material[1]; //} //for (int j = 0; j < enemyList.Count; j++) //{ // matEnemy = enemyList[j].GetComponent<EnemyMatCtrl>(); //} //for (int j = 0; j < obsList.Count; j++) //{ // obsList[j].GetComponent<Renderer>().sharedMaterial = material[0]; //} //for (int j = 0; j < enemyList.Count; i++) //{ // enemyRender = enemyList[j] //} //rendEnemy = GetComponent<Renderer>(); //rendEnemy.material.shader = Shader.Find("Toon/Lit Dissolve"); //rend = GetComponent<Renderer>(); //rend.material.shader = Shader.Find("Toon/Lit Dissolve Appear"); }
public MMDModel(Vert[] vertex, IEnumerable <Material> material, string path) { DirPath = path; Vertice = vertex; OrigVertice = new Vert[Vertice.Length]; Vertice.ArrayFullCopy(OrigVertice); Materials = material.ToList(); GpuData = new GPUData( ); GpuData.Alpha = 1; Cast = new SphereCast(Matrix.Zero); }
void Start() { sphereCast = new SphereCast(); player = GameObject.FindGameObjectWithTag("Player"); sphereCast = player.GetComponent <SphereCast>(); rend2 = GetComponent <MeshCollider>(); rend = GetComponent <Renderer>(); blockList[blockAtual].GetComponent <Renderer>().enabled = false; blockList[blockAtual].GetComponent <MeshCollider>().enabled = false; blockList[blockAtual].GetComponent <RotateItself>().enabled = false; }
void start() { sphereCast = new SphereCast(); handleTextFile = new HandleTextFile(); enemy = new List <GameObject>(); //objects = GameObject.FindGameObjectWithTag("HideObj"); enemy = GameObject.FindGameObjectsWithTag("Inimigo").ToList(); render = GetComponent <Renderer>(); //rend.enabled = true; //render.sharedMaterial = material[0]; }
// Use this for initialization void Start() { sphereCast = new SphereCast(); spawmList = GameObject.FindGameObjectsWithTag("Spawner").ToList(); listFonts = GameObject.FindGameObjectsWithTag("LifePoint").ToList(); //lifeFountain = fountain.GetComponentInChildren<LifeFountain>(); shaderCtrl = this.gameObject.GetComponent <ShaderController>(); Player = GameObject.FindGameObjectWithTag("Player"); mover = GetComponent <CharacterController>(); camController = cam.gameObject.GetComponent <CameraController>(); healthBar = gameObject.GetComponent <HealthBarPlayer>(); sphereCast = Player.GetComponent <SphereCast>(); for (int i = 0; i < listFonts.Count; i++) { lifeFountain = listFonts[i].GetComponent <LifeFountain>(); } }
public MMDModel(string path) { DirPath = Directory.GetParent(path).FullName; string[] lines = File.ReadAllLines(path); //;Face,親材質名,面Index,頂点Index1,頂点Index2,頂点Index3 //Face,"スカート腕ヘドフォン",0,858,840,855 // のように最初の文字列がVertexだと頂点 Faceだと面になる ;が最初に来るものは説明用のものなので弾く var gr = lines.GroupBy(l => l.Split(',')[0]); var gs = gr.Where(g => !g.Key.Contains(";")).ToDictionary(s => s.Key, g => g.ToList( )); Vertice = ParseCSV(gs["Vertex"]).ToArray( ); OrigVertice = new Vert[Vertice.Length]; Vertice.ArrayFullCopy(OrigVertice); // 次の文字列は材質名になるので、材質名のグループを作る var faceGr = gs["Face"].GroupBy(s => s.Split(',')[1]).ToDictionary(s => s.Key, g => g.ToList( )); Materials = Material.MakeFromCSV(gs["Material"], faceGr, Vertice).ToList(); GpuData = new GPUData( ); GpuData.Alpha = 1; Cast = new SphereCast(Matrix.Zero); }
void Start() { //sphereCast = new SphereCast(); WriteText("test_", lines, columns); createMap("map"); selfSpawner = GameObject.FindGameObjectWithTag("Spawner").transform; enemPosition = new List <Vector3>(); playerPrefab = GameObject.FindGameObjectWithTag("Player"); gamePrefab = GameObject.FindGameObjectWithTag("Game"); playerCmd = playerPrefab.GetComponent <PlayerComand>(); saveLoad = gamePrefab.GetComponent <SaveLoadGame>(); sphereCast = playerCmd.GetComponent <SphereCast>(); // maneira a ser lida pelo editor da unity theSourceFile = new FileInfo("Assets\\StreamingAssets\\test_" + myId + ".txt"); //maneira para enviar para build //theSourceFile = new FileInfo("A Light Before - Prototype_Data\\StreamingAssets\\test_" + myId + ".txt"); reader = theSourceFile.OpenText(); //createEnemies("map"); //print("passou aqui"); //LoadText("map"); createEnemies(lines); for (int i = 0; i < enemyList.Count; i++) { enemyMatCtrl = enemyList[i].GetComponent <EnemyMatCtrl>(); } }
private void initializeRayCasting() { maxCameraDistance = Vector3.Distance(observedObject.position, transform.position); clipZoomRayPlayerToCam = new RayCast(observedObject.position, camTarget.position, observedObject, null); hideRayCamToPlayer = new SphereCast(transform.position, observedObject.position, rayRadiusObstructionHiding * transform.lossyScale.y * 0.01f, transform, observedObject); }
void start() { sphereCast = new SphereCast(); handleTextFile = new HandleTextFile(); render = GetComponent <Renderer>(); }
// Use this for initialization void Start() { playerPrefab = GameObject.FindGameObjectWithTag("Player"); playerCmd = playerPrefab.GetComponent <PlayerComand>(); sphereCast = playerCmd.GetComponent <SphereCast>(); }