示例#1
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (_isReached)
        {
            return;
        }

        PlayerCollector player = collision.gameObject.GetComponent <PlayerCollector>();

        if (player != null)
        {
            _isReached = true;
            switch (_type)
            {
            case CheckpointType.Intermediate:
                EventsHandler.RaiseEvent <ICheckpointReachHandler>(h => h.CheckpointReach(this));
                ShowInsert(InsertsContainer.INSTANCE.checkpointReach);
                break;

            case CheckpointType.Final:
                EventsHandler.RaiseEvent <ILevelFinishedHandler>(h => h.LevelFinished());
                ShowInsert(InsertsContainer.INSTANCE.levelFinish);
                break;
            }
        }
    }
示例#2
0
 // Use this for initialization
 void Start()
 {
     spawnHeight      = transform.position.y;
     rbody            = GetComponent <Rigidbody>();
     mPlayerCollector = myPlayer.GetComponent <PlayerCollector>();
     mPlayerHealth    = myPlayer.GetComponent <PlayerHealth>();
     mSkin            = GetComponentInChildren <SkinnedMeshRenderer>();
 }
示例#3
0
 void Start()
 {
     _audioSource = GetComponent <AudioSource>();
     //_renderer = GetComponent<Renderer>();
     goatParts     = transform.GetChild(2);
     myCam         = gameObject.transform.GetChild(0).GetComponent <Camera>();
     goatShakeAnim = gameObject.transform.GetChild(1).GetComponent <Animation>();
     callTimer     = Random.Range(3, 10);
     playerRender  = player.transform.GetChild(0).gameObject;
     moveScript    = player.GetComponent <PlayerController>();
     collectScript = player.GetComponent <PlayerCollector>();
 }
示例#4
0
    public void processTurnAdmin()
    {
        Debug.Log("Begin Process Turn Admin");
        // State.setCurrentTurnOrderIndex(0);
        State.setCurrentPlayer(0);
        // MyEnum.GamePhase currentPhase = State.GetPhase();
        App    app         = UnityEngine.Object.FindObjectOfType <App>();
        int    playerIndex = app.GetHumanIndex();
        Nation humanPlayer = State.getNations()[playerIndex];

        State.currentPlayer = 0;
        Nation currentPlayer = State.getNations()[0];
        // PlayerCollector.collectForPlayer(player);

        // Debug.Log("Count of getTurnOrder: " + State.getTurnOrder().Count);
        bool first = true;

        while (currentPlayer.getIndex() != 0 || first == true)
        {
            first = false;
            // Debug.Log("Current Turn Order Index: " + State.currentTurnOrderIndex);
            //   Debug.Log("Current player is index: " + currentPlayer.getIndex());
            if (humanPlayer.getIndex() == currentPlayer.getIndex())
            {
                currentPlayer = State.getNextPlayer();
            }
            // EarlyGameAdminstration.mainEarlyAdminLoop(currentPlayer);
            //------------------------------------------------------------------
            currentPlayer.getAI().processAdminstrationPhase(currentPlayer);
            // PlayerProcessor.processSignals(currentPlayer);
            //  maintenancePayer.payMaintenance(currentPlayer);
            PlayerCollector.collectForPlayer(currentPlayer);
            currentPlayer = State.getNextPlayer();
            Debug.Log("New current player is: " + currentPlayer.getName() +
                      " " + currentPlayer.getIndex());

            Queue <int> newRailroads = currentPlayer.getAI().NewRailRoads;
            while (newRailroads.Count > 0)
            {
                int nextProvIndex            = newRailroads.Dequeue();
                assemblyCsharp.Province prov = State.getProvinces()[nextProvIndex];
                railPlacer.drawRailroadOnMap(prov, currentPlayer);
            }
        }



        //  State.advanceGamePhase();
        Debug.Log(State.GetPhase());

        return;
    }
示例#5
0
    private void Turn_Button()
    {
        if(State.turn >= demoTurnLimit)
        {
            endGameMessage.SetActive(true);
            return;
        }
        turnButton.interactable = false;
        Debug.Log("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA");
        Debug.Log("Begin turn processing...");
        Debug.Log("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA");
        Debug.Log("Current phase: " + State.GetPhase());
        //  blockPlayerFromActing();
        //turnPopUpEnter.Play();
        App app = UnityEngine.Object.FindObjectOfType<App>();
        int playerIndex = app.GetHumanIndex();
        Nation player = State.getNations()[playerIndex];
        //State.turn++;
        PlayerProcessor.processSignals(player);
           // MarketHelper.resetBidsAndOffers();
          //  maintenancePayer.payMaintenance(player);
        PlayerCollector.collectForPlayer(player);

        // Texting ======================================================================================
        turnHandler.processTurnAdmin();
        State.advanceGamePhase();
        State.tradeHandler.handleTrades();

        WorldBank bank = State.bank;
        Debug.Log("Banking           Banking                     Banking");
        bank.collectInterest();
        bank.distributeCollectedInterest();
        Debug.Log("Finished Banking - should not proceed to Trade Results");
        showTradeResults(player);
        TradeResults.SetActive(true);
         tradeResultsEnter.Play();
        //turnPopUpExit.Play();
           // payCoalMaintaince(player);
        updateHeaderValues();
        if (State.turn == 40)
        {
            eraUpdater.swichEra();
        }
        if (State.turn == 80)
        {
            eraUpdater.swichEra();

        }
    }
示例#6
0
    private void Awake()
    {
        //Check that we have some settings
        if (settings == null)
        {
            Debug.LogError("Minigame has no settings. Destroying");
            Destroy(this);
        }


        //Create the player collector
        playerList = new PlayerCollector(settings.maxPlayerCount);

        //---REMOVE---///
        Invoke("InitGame", 1);
    }
示例#7
0
    private void OnTriggerStay(Collider other)
    {
        if (other.tag == "Player")
        {
            pHitBox    = other.GetComponent <Collider>();
            pcollector = other.GetComponent <PlayerCollector>();
            myPlayer   = other.gameObject.transform.parent.gameObject;


            if (myDayNightCycle.currentHour > 18)
            {
                if (myPlayer != null)
                {
                    pmove = myPlayer.GetComponent <PlayerMovement>();
                    if (pmove != null)
                    {
                        pmove.canShoot = false;
                    }
                }
                finishDayCanvas.SetActive(true);
            }
        }
    }
示例#8
0
 private void Start()
 {
     myBoxCollider2D = this.GetComponentInChildren <CapsuleCollider2D>();
     playerCollector = this.GetComponent <PlayerCollector>();
 }