예제 #1
0
    void Start()
    {
        //Attaches local components and events
        myBoatView   = GetComponent <BoatView>();
        realtimeView = GetComponent <RealtimeView>();
        NetworkSyncManager.OnNetworkTurnUpdate      += BoatActiviation;
        NetworkSyncManager.OnNetworkGameStateUpdate += GameStart;
        if (realtimeView.isOwnedLocallyInHierarchy)
        {
            GetComponent <RealtimeTransform>().RequestOwnership();
        }
        myBoatView.turnHighlighter.SetActive(false);

        //Assigns boat to the correct team and updates the team model
        if (myTeamColor == GameRefModel.BoatColors.Yellow)
        {
            myTeam = app.gameRefModel.yellowTeamModel;
        }
        if (myTeamColor == GameRefModel.BoatColors.Red)
        {
            myTeam = app.gameRefModel.redTeamModel;
        }
        myTeam.boatList.Add(gameObject);
        myTeam.UpdateBoatCount();

        //Done just for this boat
        if (realtimeView.isOwnedLocallyInHierarchy)
        {
            //Instantiates and stores the PlanController
            myBoatPlan = Instantiate(planPrefab, transform.position, Quaternion.identity);
            plan       = myBoatPlan.GetComponent <PlanController>();
            myBoatPlan.SetActive(false);
            myBoatView.turnHighlighter.SetActive(false);
            BoatActiviation(app.networkSyncManager.currentTurnStateNumber, app.networkSyncManager.currentSyncedTurnColor);
            plan.myTeamModel = myTeam;
        }

        //bombIcon = GameObject.FindGameObjectWithTag("bombIcon");
        //mineIcon = GameObject.FindGameObjectWithTag("mineIcon");
        //anchorIcon.SetActive(false);

        /*if (localReferee.startWithForcefields)
         * {
         *  forceField.SetActive(true);
         * }*/
    }
 public BoatInputController(MemberRegister memberRegister) : base(memberRegister)
 {
     _boatView = new BoatView();
     _boatViewWrongInputMessages = new BoatViewWrongInputMessages();
 }
 public BoatController(BoatView boatView, Repository repository)
 {
     _boatView   = boatView;
     _repository = repository;
 }