/// <summary> /// Spawn the player according to the pointed position. /// </summary> private void SpawnPlayers() { BF_GameSettings bfgs = BF_GameSettings.instance; BF_Player[] bfPlayers = bfgs.CHARACTERS_IN_GAME; for (int index = 0; index < bfgs.CHARACTERS_IN_TEAM; ++index) { if (mSpawnPos[index] == null) { JCS_Debug.LogReminder("No Spawn position references, plz check the transform in the array"); break; } if (bfPlayers[index] == null) { JCS_Debug.LogError("Character you want to spawn does not exist"); break; } // Spawn the player, and get the // player we just spawned, in order // to set facing. BF_Player bfp = (BF_Player)JCS_Utility.SpawnGameObject( bfPlayers[index], mSpawnPos[index].transform.position); // set the starting faceing bfp.TurnFace(mSpawnPos[index].Facing); // Set player in the order layer (scene layer). JCS_OrderLayerObject jcsolo = bfp.GetComponent <JCS_OrderLayerObject>(); JCS_2DDynamicSceneManager.instance.SetObjectParentToOrderLayerByOrderLayerIndex(ref jcsolo, mOrderLayer); } }
/* Setter & Getter */ /* Functions */ private void Awake() { mShootAction = this.GetComponent <JCS_ShootAction>(); mBFPlayer = this.GetComponent <BF_Player>(); }
/* Setter & Getter */ /* Functions */ private void Awake() { mDetectAreaAction = this.GetComponentInParent <JCS_DetectAreaAction>(); mShootAction = this.GetComponentInParent <JCS_ShootAction>(); mBFPlayer = this.GetComponentInParent <BF_Player>(); }