public void rez_init_player (RichChar per, int stepID) { try { if (per == null) throw new System.ArgumentNullException ("per"); //RichChar per = a as RichChar; if (GameObject.Find (per.playername) == null) { //if (per.stand_at_prop_id == 0) // throw new UnityException ("the object current step is not set! please refer to the character setup on :" + per.playername); //Property loc = getPropertyById (per.stand_at_prop_id); ///if (loc == null) /// throw new UnityException ("cannot find the location by the property ID please go check it. Maybe this can help: set each player's stand_at_prop_id at 1."); //Vector3 pos = loc.getStepLocation (); if (per.prefab == null) throw new UnityException ("the object prefab is not set! please refer to the character setup on :" + per.playername); //per.currentstep = proertyIDtoIndex (per.stand_at_prop_id); GameObject MACHINE = (GameObject)Instantiate (per.prefab) as GameObject; MACHINE.name = per.playername; CharacterControllerLogic control = MACHINE.GetComponentInChildren<CharacterControllerLogic> () as CharacterControllerLogic; control.FansCam = Camera.main.gameObject.GetComponent<FantasticCamera> () as FantasticCamera; //per.position = pos; //fcharacter_now.transform.position = pos; per.character_stage = MACHINE; per.setGroundMask (groundonlymask); } } catch (UnityException e) { Debug.LogError (e.ToString ()); } }
public void rez_init_player (RichChar per) { try { if (per == null) throw new System.ArgumentNullException ("per"); //RichChar per = a as RichChar; if (GameObject.Find (per.playername) == null) { if (per.stand_at_prop_id == 0) throw new UnityException ("the object current step is not set! please refer to the character setup on :" + per.playername); Property loc = getPropertyById (per.stand_at_prop_id); if (loc == null) throw new UnityException ("cannot find the location by the property ID please go check it. Maybe this can help: set each player's stand_at_prop_id at 1."); Vector3 pos = loc.getStepLocation (); if (per.prefab == null) throw new UnityException ("the object prefab is not set! please refer to the character setup on :" + per.playername); per.currentstep = proertyIDtoIndex (per.stand_at_prop_id); GameObject fcharacter_now = (GameObject)Instantiate (per.prefab) as GameObject; fcharacter_now.name = per.playername; per.position = pos; fcharacter_now.transform.position = pos; per.character_stage = fcharacter_now; per.setGroundMask (ground_only_mask); } } catch (UnityException e) { Debug.LogError (e.ToString ()); } }