示例#1
0
 // Start is called before the first frame update
 void Start()
 {
     PlayerRb     = GetComponent <Rigidbody>();
     focalPoint   = GameObject.Find("FocalPoint");
     spawnManager = GameObject.Find("SpawnManager").GetComponent <SpawnManagerScript>();
     downALittle  = new Vector3(0, -0.5f, 0);
 }
    public override IEnumerator SlowUpdate()
    {
        if (IsLocalPlayer)
        {
            this.gameObject.tag = "playerManager";
            yield return(new WaitForSeconds(0.4f));//wait for scene

            pollManager = GameObject.FindGameObjectWithTag("poll");
            lobbyScript = pollManager.GetComponent <Lobby>();
            lobbyScript.AddClient(NetId);


            managerScript = GameObject.FindGameObjectWithTag("manager").GetComponent <RecipeManagerScript>();

            int tempId = MyCore.LocalPlayerId;
            //Debug.Log("My core local="+tempId);
            SendCommand("NID", tempId.ToString());
            otherOrder = true;

            this.transform.GetChild(0).gameObject.SetActive(true); // turn on UI
        }
        if (IsServer)
        {
            playerIsLeft  = false;
            playerIsRight = false;

            //for string to prefab transfrom array
            foodDictionary = new Dictionary <string, int>();
            foodDictionary.Add("Watermelon", 9);
            foodDictionary.Add("Egg", 18);
            foodDictionary.Add("Toast", 20);
            foodDictionary.Add("Daikon", 16);
            foodDictionary.Add("Tea", 10);

            cookwareDictionary = new Dictionary <string, int>();
            cookwareDictionary.Add("Cup", 8);
            cookwareDictionary.Add("Plate", 11);
            cookwareDictionary.Add("Pan", 17);
            cookwareDictionary.Add("Pot", 15);

            //spawnPos = GameObject.FindGameObjectWithTag("spawn").transform;
            spawnManager = GameObject.FindGameObjectWithTag("spawnManger").GetComponent <SpawnManagerScript>();
        }
        //true update
        while (IsServer)
        {
            if (playerIsLeft)
            {
                SendUpdate("LTS", "X");
            }
            else if (playerIsRight)
            {
                SendUpdate("RTS", "X");
            }



            yield return(new WaitForSeconds(0.5f)); //potentially slower
        }
    }
示例#3
0
 void Awake()
 {
     GameObject game = GameObject.FindGameObjectWithTag("GameController");
     spawnManager = game.GetComponent<SpawnManagerScript>();
     platformManager = game.GetComponent<PlatformManagerScript>();
     platformManager.RegisterBoundary(this);
 }
示例#4
0
 // Start is called before the first frame update
 void Start()
 {
     PlayerRB   = GetComponent <Rigidbody2D>();
     anim       = GetComponent <Animator>();
     spobject   = FindObjectOfType <SpawnManagerScript>();
     background = GameObject.Find("Background").GetComponent <RepeatBackground>();
     ground     = GameObject.Find("Ground").GetComponent <RepeatBackground>();
     ground1    = GameObject.Find("BottomGround").GetComponent <RepeatBackground>();
 }
示例#5
0
 void Awake()
 {
     if (mInstance == null)
     {
         mInstance = this;
     }
     else if (mInstance != this)
     {
         Destroy(this.gameObject);
     }
 }
示例#6
0
 // Use this for initialization
 void Start()
 {
     platformManager = GetComponent<PlatformManagerScript>();
     networkManager = GetComponent<NetworkManagerScript>();
     spawnManager = GetComponent<SpawnManagerScript>();
     menuManager = GetComponent<MenuManager>();
     lobby = GetComponent<GameLobbyScript>();
     mainMenu = GetComponent<MainMenuScript>();
     playerData = GetComponent<PlayerDataScript>();
     gameIsActive = false;
 }
示例#7
0
    // Use this for initialization
    void Awake()
    {
        score = new List<PlayerScoreInfo>();
        GameObject game = GameObject.FindGameObjectWithTag("GameController");
        hud = game.GetComponent<HUDScript>();
        scoreMenu = game.GetComponent<ScoreMenuScript>();
        gameManager = game.GetComponent<GameManagerScript>();
        spawnManager = game.GetComponent<SpawnManagerScript>();

        hud.RegisterScoreKeeper(this);
        scoreMenu.RegisterScoreKeeper(this);
        gameManager.RegisterScoreKeeper(this);
        spawnManager.RegisterScoreKeeper(this);

        ResetScore();
    }
示例#8
0
 void Start()
 {
     Rigid              = GetComponent <Rigidbody>();
     focalPoint         = GameObject.Find("Focal Point");
     spawnManagerScript = GameObject.Find("SpawnManager").GetComponent <SpawnManagerScript>();
 }
示例#9
0
 void Awake()
 {
     Instance = this;
 }
示例#10
0
 private void Awake()
 {
     instance = this;
 }