Ejemplo n.º 1
0
 void OnTriggerEnter2D(Collider2D _c2d)
 {
     if (_c2d.gameObject.name == "Netto")
     {
         DontDestroyOnLoad(_c2d.gameObject);
         _NettoScript = _c2d.gameObject.GetComponent<Netto>();
         _NettoScript._bOnGameEvent = true;
         _NettoScript._enumPlayerState = MapPlayer.PlayerState.Idle;
         StartCoroutine(_ieTransformMap(0.5f));
     }
     else if (_c2d.gameObject.name == "RockMan")
     {
         DontDestroyOnLoad(_c2d.gameObject);
         _RockmanScript = _c2d.gameObject.GetComponent<RockMan>();
         _RockmanScript._bOnGameEvent = true;
         _RockmanScript._enumPlayerState = MapPlayer.PlayerState.Idle;
         StartCoroutine(_ieTransformMap(0.5f));
     }
 }
Ejemplo n.º 2
0
 private void _mCreateRockMan()//生成洛克人
 {
     GameObject _gRockMan = GameObject.Find("RockMan");
     if (_gRockMan != null)
     {
         _RockmanScript = _gRockMan.GetComponent<RockMan>();
     }
     else
     {
         _gRockMan = Instantiate(Resources.Load("Prefab/Rockman", typeof(GameObject))) as GameObject;
         if (!PlayerPrefs.HasKey("RockManStartPosX") && !PlayerPrefs.HasKey("RockManStartPosY"))//測試用,非從現實世界進入
         {
             _gRockMan.transform.position = _v3ClonePosition;
         }
         else//從現實世界進入
         {
             _gRockMan.transform.position = new Vector3(PlayerPrefs.GetFloat("RockManStartPosX"), PlayerPrefs.GetFloat("RockManStartPosY"), 0);
         }
     }
     _gRockMan.name = "RockMan";
     _RockmanScript = _gRockMan.GetComponent<RockMan>();
 }