PRDarkSide

PhotonEnemy

Sep 3rd, 2019
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.95 KB | None | 0 0
  1. using Photon.Pun;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.IO;
  5. using UnityEngine;
  6.  
  7.  
  8. public class PhotonEnemy : MonoBehaviour
  9. {
  10.     private PhotonView PV;
  11.     private PhotonRoomCustomMatch PRCM;
  12.     public GameObject myAvatar;
  13.  
  14.     int spawnNumber;
  15.     int enemyAmount;
  16.  
  17.     // Start is called before the first frame update
  18.     void Start()
  19.     {
  20.         PV = GetComponent<PhotonView>();
  21.         spawnNumber = 0;
  22.         enemyAmount = 4;
  23.         if (PhotonNetwork.IsMasterClient)
  24.         {
  25.             SpawnEnemies();
  26.         }
  27.     }
  28.  
  29.     void SpawnEnemies()
  30.     {
  31.         for (int i = 0; i < enemyAmount; i++)
  32.         {
  33.             int spawnPicker = spawnNumber++;
  34.             myAvatar = PhotonNetwork.InstantiateSceneObject(Path.Combine("Prefabs", "Enemy"),
  35.                 GameSetup.GS.enemySpawnPoints[spawnPicker].position, GameSetup.GS.enemySpawnPoints[spawnPicker].rotation, 0);
  36.         }
  37.     }
  38. }
Add Comment
Please, Sign In to add comment