示例#1
0
    void OnGUI()
    {
        List <KeyCode> KeyList = new List <KeyCode>();

        KeyList.Add(KeyCode.Space);
        KeyList.Add(KeyCode.A);
        KeyList.Add(KeyCode.S);
        KeyList.Add(KeyCode.W);
        KeyList.Add(KeyCode.D);
        foreach (KeyCode tmpKey in KeyList)
        {
            if (Input.GetKey(tmpKey))
            {
                GameStateScript.KeyAction(tmpKey);
            }
        }

        GUI.Box(new Rect(10.0f, 10.0f, 100.0f, 30.0f), "Score: " + score);
        string livesString = "Lives: ";

        for (int i = 0; i < numberOfLives; ++i)
        {
            livesString += "A ";             // These look like little ships :P
        }
        GUI.Box(new Rect(10.0f, Screen.height - 30.0f, 100.0f, 30.0f), livesString);
    }
示例#2
0
    // Use this for initialization
    void Start()
    {
        thisCollider = GetComponent <BoxCollider2D>();

        player    = GameObject.Find("player").GetComponent <BoxCollider2D> ();
        gameState = GameObject.Find("GameState").GetComponent <GameStateScript> ();
    }
 // Use this for initialization
 void Start()
 {
     gameStateManager = GameObject.Find("GameStateManager");
     gameStateScript = gameStateManager.GetComponent<GameStateScript>();
     MainCamera = GameObject.Find("Main Camera");
     BackgroundController = MainCamera.GetComponent<BackgroundController>();
 }
 // Use this for initialization
 void Start()
 {
     gameStateManager = GameObject.Find("GameStateManager");
     gameStateScript = gameStateManager.GetComponent<GameStateScript>();
     gameStateScript.BackgroundTimer = 2;
     BackgroundTimer = gameStateScript.BigTimer;
     CanCreate = gameStateScript.CanCreate;
 }
示例#5
0
    // Start is called before the first frame update
    void Start()
    {
        player = GameObject.Find("Player");
        transf = player.transform;

        state = GameObject.Find("GameState").GetComponent <GameStateScript>();
        ps    = GameObject.Find("PlayerStatus").GetComponent <PlayerStatusScript>();
        scene = GameObject.Find("SceneChanger").GetComponent <SceneChangerScript>();
    }
 void Start()                                                                                // When the script starts.
 {
     controller             = GetComponent <CharacterController>();                          // We get the player's CharacterController.
     gameStateDataScriptRef = GameObject.Find("GameState").GetComponent <GameStateScript>(); // Game State Script ref
     moveDirection          = Vector3.zero;                                                  // We set the player's direction to (0,0,0).
     input    = GetComponent <PlayerInput>();                                                // We get the player's input controller.
     camera   = Camera.main;                                                                 // We fetch the main camera.
     state    = PlayerState.STANDING;
     animator = GetComponentInChildren <Animator>();
 }
示例#7
0
    // Use this for initialization
    void Start()
    {
        gameStateDataScriptRef = GameObject.Find("GameState").GetComponent <GameStateScript>();

        lightMode = LightMode.NEAR;
        defaultLightCylinderScale = lightCylinder.transform.localScale.z;
        input = PlayerInput.instance;

        playerCylAngleOffset = Vector3.Angle(transform.forward, lightCylinder.transform.forward);
    }
示例#8
0
 // Use this for initialization
 void Start()
 {
     gameStateManager = GameObject.Find("GameStateManager");
     gameStateScript = gameStateManager.GetComponent<GameStateScript>();
     Credibility = gameStateScript.Credibility;
     gameStateScript.Playing = true;
     gameStateScript.GameOver = false;
     Time.timeScale = 1.0f;
     GameOver = false;
 }
    // Use this for initialization
    void Start()
    {
        player = GameObject.Find("player");

        circle        = GetComponent <CircleCollider2D>();
        rigidBody     = GetComponent <Rigidbody2D>();
        circle.radius = sightRadius;

        gameState = GameObject.Find("GameState").GetComponent <GameStateScript> ();
        halt      = GetComponent <TouchAndHalt> ();
    }
示例#10
0
 // Use this for initialization
 void Start()
 {
     gameStateScript = gameStateManager.GetComponent <GameStateScript>();
     scoreTracker    = new ScoreTracker(transform);
     IdentifyDisc();
     throwSignal = false;
     holdingDisc = true;
     ableToCatch = false;
     time        = 0;
     GetComponent <Collider>().enabled = false;
 }
    // Use this for initialization
    void Start()
    {
        float rad       = pathDirection * Mathf.Deg2Rad;
        float rotationX = Mathf.Cos(rad) * travelDist;
        float rotationY = Mathf.Sin(rad) * travelDist;

        startPos           = new Vector2(transform.position.x + rotationX, transform.position.y + rotationY);
        endPos             = new Vector2(transform.position.x - rotationX, transform.position.y - rotationY);
        transform.position = startPos;
        startTime          = Time.time;

        gameState = GameObject.Find("GameState").GetComponent <GameStateScript> ();
    }
示例#12
0
    void Start()
    {
        GameStateScript.addStateListener(this);

        // AudioSource mainAudio = FindObjectOfType(typeof(AudioSource));
        //mainAudio = GetComponents<AudioSource>();

        audio1 = playerCamera.GetComponents <AudioSource>();

        /* foreach (HingeJoint joint in hingeJoints) {
         *   joint.useSpring = false;
         * }*/
        //audio1 = playerCamera[0];
    }
示例#13
0
 // Use this for initialization
 void Start()
 {
     gameStateManager = GameObject.Find("GameStateManager");
     gameStateScript = gameStateManager.GetComponent<GameStateScript>();
     MainCamera = GameObject.Find("Main Camera");
     BackgroundController = MainCamera.GetComponent<BackgroundController>();
     MainGUI = MainCamera.GetComponent<MainGUI>();
     JumpSoundObject = GameObject.Find("JumpSoundDumpster");
     jumpSoundScript = JumpSoundObject.GetComponent<JumpSoundScript>();
     PlayerLose = PlayerStart - 2;
     Lost = false;
     gameStateScript.Lost = false;
     gameStateScript.Won = false;
     gameStateScript.GameOver = false;
 }
示例#14
0
    void Awake()
    {
        DontDestroyOnLoad(this.gameObject);
        Object[] gameStates = FindObjectsOfType(typeof(GameStateScript));
        if (gameStates.Length == 1)
        {
            instance  = this;
            gameState = startGameState;
        }
        else
        {
            Destroy(this.gameObject);
        }

        gameStateListeners = new List <IGameStateListener>();
    }
示例#15
0
    // Use this for initialization
    void Start()
    {
        gameState = GameObject.Find("GameState").GetComponent <GameStateScript>();
        gameMusic = GetComponent <AudioSource>();

        music = new Dictionary <string, AudioClip>();
        music.Add("FlushedTestSong1", Resources.Load("FlushedTestSong1") as AudioClip);
        music.Add("FlushedTestSong2", Resources.Load("FlushedTestSong2") as AudioClip);
        music.Add("Siren", Resources.Load("siren") as AudioClip);

        currentState = gameState.GetMusicState();

        PlayMusic(currentState);

        //Debug.Log(Resources.Load("FlushedTestSong1"));
    }
示例#16
0
        void Start()
        {
//      if (_pinchDetectorA == null || _pinchDetectorB == null) {
//        Debug.LogWarning("Both Pinch Detectors of the LeapRTS component must be assigned. This component has been disabled.");
//        enabled = false;
//      }

            GameObject pinchControl = new GameObject("RTS Anchor");

            _anchor = pinchControl.transform;
            _anchor.transform.parent = transform.parent;
            //transform.parent = _anchor;

            isPickedUp      = false;
            rbd             = this.GetComponent <Rigidbody>();
            gameStateScript = GameObject.Find("GameState").GetComponent <GameStateScript>();
        }
示例#17
0
    void Start()
    {
        newgamebutton.Select();
        gs    = GameObject.Find("GameStatus").GetComponent <GameStatusScript>();
        state = GameObject.Find("GameState").GetComponent <GameStateScript>();
        scene = GameObject.Find("SceneChanger").GetComponent <SceneChangerScript>();


        // set GameState to mainmenu
        state.SetGameState(GameStateScript.GameState.MAIN_MENU);

        // set gameplay to none
        state.SetPlayState(GameStateScript.PlayState.NONE);

        // Set GameStatus to New
        gs.StartNewGame = true;

        hidemusic.SetActive(false);
    }
    void Start()
    {
        //Reference Initializations:
        gameStateDataScriptRef = GameObject.Find("GameState").GetComponent <GameStateScript>();
        BaseWorldSpawnRef      = GameObject.Find("BaseWorldSpawn");

        //File selector: Default upper left boat selected
        highlightedFilenum = 1;
        highlightedFile[0] = false;
        highlightedFile[1] = false;

        /*
         * SelectorEnvironment = GameObject.Find("MENU_PORT");
         * FileSelectorBoat1 = SelectorEnvironment.transform.GetChild(0).gameObject;
         * FileSelectorBoat2 = SelectorEnvironment.transform.GetChild(1).gameObject;
         * FileSelectorBoat3 = SelectorEnvironment.transform.GetChild(2).gameObject;
         * FileSelectorBoat4 = SelectorEnvironment.transform.GetChild(3).gameObject;
         */
        input = PlayerInput.instance;
        light = GetComponent <PlayerLight>();

        amount = light.healthDrainAmmount;
    }
示例#19
0
 void Start()
 {
     // Store main car script and the gameState script.
     carScript = GetComponent <Car>();
     gameState = GameObject.Find("GameState").GetComponent <GameStateScript>();
     // Bindes the correct input type dependent on the gameState.
     if (gameState.controllerType == 0)
     {
         inputType = ControllerType.keyboard;
     }
     else if (gameState.controllerType == 1)
     {
         inputType = ControllerType.xboxController;
     }
     else if (gameState.controllerType == 2)
     {
         inputType = ControllerType.ps4Controller;
     }
     else if (gameState.controllerType == 3)
     {
         inputType = ControllerType.steeringWheel;
     }
     // Bindes the correct gear type dependent of the gameState.
     if (gameState.gearType == 0)
     {
         shiftType = gearShiftType.automatic;
     }
     else if (gameState.gearType == 1)
     {
         shiftType = gearShiftType.hShift;
     }
     else if (gameState.gearType == 2)
     {
         shiftType = gearShiftType.paddleShift;
     }
 }
 // Use this for initialization
 void Start()
 {
     gameStateManager = GameObject.Find("GameStateManager");
     gameStateScript = gameStateManager.GetComponent<GameStateScript>();
 }
示例#21
0
    // Use this for initialization
    void Start()
    {
        gameStateScript = this.GetSingleton<GameStateScript>();
        burnedState = this.GetSingleton<BurnedGameStateScript>();
        if (KillArea != null)
        {
            KillArea.OnKillAreaEntered = new KillAreaTrigger.OnKillAreaEnteredEventHandler();
            KillArea.OnKillAreaEntered.AddListener(() => PreyHasEnteredKillZone = true);
        }

        StartCoroutine("UpdateCheckPreyDistance");
    }
	// Use this for initialization
	void Start () {
		gameState = GameObject.Find ("GameState").GetComponent<GameStateScript>();
		Debug.Log("Has clicked Fire1 " + gameState.fire1ClickedCount + " times.");
	}
	// Use this for initialization
	virtual public void Start () {
		gameState = GameObject.Find ("GameState").GetComponent<GameStateScript>();
	}
    // Use this for initialization
    void Start()
    {
        gameStateManager = GameObject.Find("GameStateManager");
        gameStateScript = gameStateManager.GetComponent<GameStateScript>();

        gameStateScript.WeaponsInPlay = 0;
        gameStateScript.TrashCansInPlay = 0;
    }
示例#25
0
 private void Awake()
 {
     Instance = this;
 }