Beispiel #1
0
    IEnumerator InitiateRound()
    {
        initiated    = true;
        roundWinner  = null;
        gameWinner   = null;        //Just in case..
        roundWasDraw = false;
        float camResetTime = 1f;

        cam.SetCameraTargetPosition(cam.StartPosition, camResetTime);

        yield return(new WaitForSeconds(camResetTime));

        int count = roundCountDownTime;

        while (count > 0)
        {
            ui.SetMiddleScreenText(count.ToString());
            count--;

            yield return(new WaitForSeconds(1f));
        }

        ui.SetMiddleScreenText("GO!");

        state = GameState.Round;

        initiated = false;

        yield return(new WaitForSeconds(0.5f));

        ui.DisableMiddleScreenText();
    }
Beispiel #2
0
    void Start()
    {
        properties = GetComponent <AirplaneManager>();

        plane = properties.meshInstance.transform;
        input = GetComponent <InputManager>();

        startDirection = transform.forward;

        speed = minSpeed;
    }
Beispiel #3
0
    void OnTriggerEnter(Collider col)
    {
        if (taken)
        {
            return;
        }


        if (col.GetComponent <AirplaneManager>())
        {
            taken = true;

            AirplaneManager airplane = col.GetComponent <AirplaneManager>();
            GameObject      instance = Instantiate(power.gameObject, airplane.transform);

            StartCoroutine(GetTaken(col.transform));
        }
    }
Beispiel #4
0
    void Start()
    {
        properties = GetComponent <AirplaneManager>();

        mesh = properties.meshInstance;

        meshCount = mesh.transform.childCount;


        childs = new Transform[meshCount];

        int i = 0;

        foreach (Transform child in mesh.transform)
        {
            childs[i] = child;
            i++;
        }
    }
    public void saveGame()
    {
        Session getSession()
        {
            AirplaneManager airplaneManager = airplaneObject.GetComponent <AirplaneManager>();

            if (airplaneManager != null)
            {
                float   health  = airplaneManager.getCurrentHealth();
                int     score   = airplaneManager.getCurrentScore();
                Session session = new Session(currentSession.airplaneId, currentSession.environmentId, DateTime.Now.ToString(), new GameState(health, (int)currentDifficulty, 0, score));
                return(session);
            }
            return(null);
        }

        Session sessionToSave = getSession();

        presenter.saveSession(sessionToSave);
    }
Beispiel #6
0
    // Use this for initialization

    private void Awake()
    {
        instance = this;
    }
Beispiel #7
0
    void UpdatePerPlayer()
    {
        int    currentAlivePlayers = 0;
        string playerUIName        = "Player";
        int    playerIndex         = 0;

        //print(players[3].name);

        foreach (AirplaneManager player in players)
        {
            if (!player.health.Dead)
            {
                currentAlivePlayers++;
            }

            if (state >= GameState.PreRound &&
                state <= GameState.RoundEnd)
            {
                string temporaryName = playerUIName + " " + (playerIndex + 1).ToString();                       //Replace me later with real names.
                ui.DrawPlayerScore(playerIndex, temporaryName, player.wins);
            }


            switch (state)
            {
            case GameState.PreGame:                     //Never goes in here atm

                player.EnableInput(false);
                player.EnableFlight(false);

                break;

            case GameState.PreRound:

                if (GlobalVariables.inputs[playerIndex] != GlobalVariables.ControlType.Noone)
                {
                    GlobalVariables.ControlType inputTypeToUse = GlobalVariables.inputs[playerIndex];
                    player.SetInputType(inputTypeToUse);
                    print(inputTypeToUse);
                }

                player.EnableInput();
                player.EnableFlight();

                if (player.health.Dead)
                {
                    player.Revive();
                }

                player.ResetPosition();
                player.ResetSmasherPosition();

                break;

            case GameState.Round:

                if (!roundHasStarted)
                {
                    player.EnableInput();
                    player.EnableFlight();
                    roundHasStarted = true;
                }

                if (alivePlayers == 1 && !player.health.Dead)
                {
                    //This person wins the round.

                    if (!roundWinner)
                    {
                        roundWinner = player;
                        roundWinner.wins++;
                    }
                }

                break;

            case GameState.RoundEnd:

                break;

            case GameState.GameEnd:

                break;

            case GameState.None:

                break;
            }

            playerIndex++;
        }

        alivePlayers = currentAlivePlayers;
    }
Beispiel #8
0
 protected virtual void Awake()
 {
     airplane = transform.parent.GetComponent <AirplaneManager>();
 }
Beispiel #9
0
 public void Initialize()
 {
     _simprops  = new Mock <ISimulationProperties>();
     _apManager = new AirplaneManager(_simprops.Object);
 }
Beispiel #10
0
 void Awake()
 {
     Instance = this;
     SpawnNextAirplane();
 }