Inheritance: MonoBehaviour
示例#1
0
    private bool isJump = true;             // Set a player is moment to jump

    void Awake()
    {
        // Setting up references.
        this.groundCheck = transform.Find("groundCheck");
        this.movementBehaviour = GetComponent<MovementBehaviour>();
        this.inputController = GameObject.Find("MyControl").GetComponent<InputController>();
    }
示例#2
0
文件: Library.cs 项目: taboo1/arena
    // Use this for initialization
    void Start()
    {
        currentScore = GameObject.Find("CurrentScore").GetComponent<CurrentScore>();
        fullScore = GameObject.FindObjectOfType<FullScore>();
        score = GetComponent<Score>();
        energy = GetComponent<Energy>();
        energyLine = GameObject.FindObjectOfType<EnergyLine>();
        inputController = GameObject.FindObjectOfType<InputController>();
        timerScript = GameObject.FindObjectOfType<TimerScript>();
        timerUI = GameObject.FindObjectOfType<TimerUI>();
        info = GetComponent<Info>();
        taskStrings = GetComponent<TaskStrings>();
        pauseButton = GameObject.FindObjectOfType<PauseButton>().gameObject;
        pauseMenu = GameObject.Find("Canvas").GetComponentInChildren<PauseMenu>();
          //  endMenu = GameObject.FindObjectOfType<EndMenu>();
        taskHelper = GameObject.FindObjectOfType<TaskHelper>();
        globalController = GetComponent<GlobalController>();
        cam = GameObject.Find("MainCamera");
        secondCamera = GameObject.Find("SecondCamera");
        wordRideCanvas = GameObject.FindObjectOfType<WordRideCanvas>();

        metalSparksPrefab = Resources.Load("Prefabs/Particles/MetalSpark") as GameObject;
        carUserParametres = GetComponent<CarUserParametres>();
        gameUI = GameObject.FindObjectOfType<GameUI>();
        canvasController = GameObject.FindObjectOfType<CanvasController>();

        particleCanvas = GameObject.Find("ParticleCanvas");
        carCreator = GameObject.FindObjectOfType<CarCreator>();

        mainBonus = GameObject.FindObjectOfType<MainBonus>();

        waitBackground = GameObject.FindObjectOfType<WaitBackground>();
    }
 private void Awake()
 {
     if (Instance == null)
         Instance = this;
     //inputDevice = InputManager.ActiveDevice;
     charState = GameObject.FindObjectOfType<RomanCharState>();
 }
 // Use this for initialization
 void Start()
 {
     rBody = GetComponent<Rigidbody2D>();
     //sGround = GetComponent<StayGrounded>();
     groundCheck = GetComponentInChildren<IsGrounded>();
     iCont = GetComponent<InputController>();
     IAction[] attachedActions = GetComponents<IAction>();
     for (int i = 0; i < attachedActions.Length; i++)
     {
         if (attachedActions[i].IsAttack())
             specialAttack = attachedActions[i];
         else
             specialDefense = attachedActions[i];
     }
     GameObject go = GameObject.FindGameObjectWithTag("Baton");
     if (go != null)
         crown = go.transform;
     startLocation = transform.position;
     renderers = new List<SpriteRenderer>();
     renderers.AddRange(GetComponentsInChildren<SpriteRenderer>());
     renderers.Add(GetComponent<SpriteRenderer>());
     colliders = new List<Collider2D>();
     colliders.AddRange(GetComponentsInChildren<Collider2D>());
     colliders.AddRange(GetComponents<Collider2D>());
     aController = GetComponent<Animator>();
     crownLocation = transform.FindChild("CrownLocation");
     GetComponentInChildren<TankGun>().playerID = playerID;
     movementSpeed *= Manager.instance.moveMultiplier;
     explosionParticles = transform.FindChild("player explosion").GetComponent<ParticleSystem>();
     jumpParticles = transform.FindChild("Jump poof").GetComponent<ParticleSystem>();
     dustParticles = transform.FindChild("dust poof").GetComponent<ParticleSystem>();
 }
 // Use this for initialization
 void Start()
 {
     this.rb = GetComponent<Rigidbody> ();
     this.ip = GetComponent<InputController> ();
     this.exhaust1 = exhaust.transform.FindChild ("Pipe0").FindChild ("ExhaustSmoke").GetComponent<ParticleSystem> ();
     this.exhaust2 = exhaust.transform.FindChild ("Pipe1").FindChild ("ExhaustSmoke").GetComponent<ParticleSystem> ();
 }
    public void Start() {
        inputController = GetComponent<InputController>();
        comboUI = ComboUI.Instance;
        comboUI.enabled = false;

        currentDay = 1;
        powerUp = 0;
        hardMode = PlayerPrefs.GetInt("hardmode");
        if (hardMode == 1) {
            dayLengh = 60.0f;
        } else {
            dayLengh = 45.0f;
        }

        patients = new Queue<PatientController>();

        pat1Pos = patient1.transform.position;
        pat2Pos = patient2.transform.position;
        pat3Pos = patient3.transform.position;

        currentPopulation = initialPopulation;

        dayIntroSplashScreen = GameObject.Find("DayIntroSplashScreen");
        dayEndSplashScreen = GameObject.Find("DayEndSplashScreen");
        gameOverSplashScreen = GameObject.Find("GameOverSplashScreen");

        patientBar = GameObject.Find("PatientTime");
        gameHUD = GameObject.Find("GameHUD");

        dayEndSplashScreen.SetActive(false);
        patientBar.SetActive(false);
        gameOverSplashScreen.SetActive(false);

        currentState = GameStates.INTRO;
    }
    //initialization
    void Start()
    {
        //set reference to GUI Texts
        promptGUI = GameObject.Find("Canvas/PrompterText").GetComponent<Text>();
        inputGUI = GameObject.Find("Canvas/InputText").GetComponent<Text>();
        playerGUI = GameObject.Find("Canvas/PlayerText").GetComponent<Text>();
        arrowGUI = GameObject.Find("Canvas/ArrowText").GetComponent<Text>();
        gameGUI = GameObject.Find("Canvas/GameText").GetComponent<Text>();

        //set reference to controller variables
        inputControl = GameObject.Find("GameController").GetComponent<InputController>();
        gameController = GameObject.Find("GameController").GetComponent<GameController>();
        imgController = GameObject.Find("GameController").GetComponent<ImagePlaneController>();

        //init text variables
        prompterText = "";
        inputText = "";
        playerText = "";
        gameText = "";
        arrowText = "";

        //init textDictionary
        textDictionary = new Dictionary<InputMode, string>();
        textDictionary.Add(InputMode.getMove, "(M)ove or (S)hoot?");
        textDictionary.Add(InputMode.getRoom, "Pick a room to move into");
        textDictionary.Add(InputMode.getArrowPath, "Pick a room to shoot your arrow through : ");
        textDictionary.Add(InputMode.won, "Aha! You got the Wumpus! ");
        textDictionary.Add(InputMode.lost, "You lost! ");
        textDictionary.Add(InputMode.wumpus, "Oops, bumped a Wumpus!");
        textDictionary.Add(InputMode.bat, "Zap--Super Bat snatch! Elsewhereville for you!");
        textDictionary.Add(InputMode.pit, "YYYIIIIEEEE . . . fell in a pit");
        textDictionary.Add(InputMode.getPlayAgain, "Play again? \n 1)New game, hazards in SAME place \n 2) New game, hazards in NEW places \n 3) Quit");
    }
	void Start () {
        fRWheel = transform.FindChild("FR_Phys_Wheel").GetComponent<WheelController>();
        fLWheel = transform.FindChild("FL_Phys_Wheel").GetComponent<WheelController>();
        bRWheel = transform.FindChild("RR_Phys_Wheel").GetComponent<WheelController>();
        bLWheel = transform.FindChild("RL_Phys_Wheel").GetComponent<WheelController>();
        massCenterPosition = transform.FindChild("Mass_Center").localPosition;

        rb = GetComponent<Rigidbody>();
        inputController = GetComponent<InputController>();

        currentGear = 0;
        gearRatio = gearRatios[currentGear];
        engineRpm = minRpm;

        centerToFrontWheels = GameObject.Find("F_Axel").GetComponent<Transform>().localPosition.z - massCenterPosition.z;
        centerToBackWheels = massCenterPosition.z - GameObject.Find("R_Axel").GetComponent<Transform>().localPosition.z;
        frontToBackWheels = centerToBackWheels + centerToFrontWheels;

        centerToLeftWheels = massCenterPosition.x - GameObject.Find("FL_Wheel").GetComponent<Transform>().localPosition.x;
        centerToRightWheels = GameObject.Find("FR_Wheel").GetComponent<Transform>().localPosition.x - massCenterPosition.x;
        leftToRightWheels = centerToRightWheels + centerToLeftWheels;

        velocity = new Vector3();
        prevVelocity = velocity;
	}
//	public string veritcalAimGatlinAxis;

	void Awake() {
		anim = GetComponent<Animator>();
		rb = GetComponent<Rigidbody>();
		instance = this;

		GameObject choicesGo = GameObject.FindGameObjectWithTag("Choices");
		choices = choicesGo.GetComponent<Choices>();
	}
示例#10
0
    void Start()
    {
        _InputController = new InputController(UseKeyboardSimulator);
        _InputElements = new Dictionary<EElementType, InputElement>();
        _GameElements = new List<GameObject>();

        _LoadPrefabs();
    }
示例#11
0
 // Use this for initialization
 void Awake()
 {
     InitChargeStats();
     ResetPower();
     iCont = transform.parent.GetComponent<InputController>();
     firePosition = transform.FindChild("FirePosition");
     pCont = transform.parent.GetComponent<PlayerController>();
 }
示例#12
0
    void Start()
    {
        inputControl = FindObjectOfType<InputController>();

        float screenScale = (Screen.width / 3000.00f);

        gameObject.transform.localScale = new Vector2(screenScale, screenScale);
    }
    void OnNetworkLoadedLevel()
    {
        player                      = GameObject.FindGameObjectWithTag("Player");
        script_player               = player.GetComponent(typeof(PlayerScript)) as PlayerScript;

        KinectAvatar                = GameObject.FindGameObjectWithTag("KinectAvatar");
        script_kinect               = KinectAvatar.GetComponent(typeof(InputController)) as InputController;
    }
 void Start()
 {
     GameObject icg = GameObject.Find (inputControllerName);
     ic = icg.GetComponent<InputController> ();
     axisInfo = new Dictionary<string, int> ();
     ctrlInfo = new Dictionary<string, string[]> ();
     addInfo ();
     addCtrls();
 }
示例#15
0
    void Awake()
    {
        if (GameObject.Find("Terrain")) terrainUtils = GameObject.Find ("Terrain").GetComponent<TerrainUtils>();
        selector = gameObject.AddComponent<Selector>();
        input = gameObject.AddComponent<InputController>();
        time = gameObject.AddComponent<TimeController>();

        commanderSkin = Resources.Load("CommanderGUI") as GUISkin;
    }
 public GameStateController( EntityController entityController, InputController.UpdateWaveTimer updateWaveTimer )
 {
     this.updateWaveTimer = updateWaveTimer;
     StartWaveTimer( startTimeout );
     this.entityController = entityController;
     spawn = new Spawn( entityController );
     baraksModels = GameObject.FindObjectsOfType<BaraksModel>();
     AddHero();
 }
    // Use this for initialization
    void Start()
    {
        rend = GetComponent<Renderer>();
        trans = GetComponent<Transform>();
        imgController = GameObject.Find("GameController").GetComponent<ImagePlaneController>();

        id = Int32.Parse(gameObject.name.Substring(12));
        inputController = GameObject.Find("GameController").GetComponent<InputController>();
    }
示例#18
0
        public GameController()
        {
            _game = Game.Current;

            _boardview = new BoardView();
            _gameview = new GameView();

            _inputController = new InputController();
        }
示例#19
0
 void Awake()
 {
     if (_instance == null) {
         _instance = this;
         init ();
     } else {
         Destroy(this);
     }
 }
 public TestGamePleaseIgnore(string title, RunnableComponent runnableComponent)
 {
     this.isRunning = false;
     this.fps = 0;
     this.title = title;
     this.runnableComponent = runnableComponent;
     //textures = new Textures();
     input = new InputController();
 }
示例#21
0
文件: Player.cs 项目: SarahTan/GGJ16
    public Player()
    {
		_soundManager = SoundManager.Instance;
		_comboManager = ComboManager.Instance;
		_inputController = InputController.Instance;
        _gameManager = GameManager.Instance;
        _buildingManager = BuildingManager.Instance;
        _eventManager = EventManager.Instance;
        heroManager = new HeroManager();
    }
示例#22
0
    void Awake()
    {
        inputController = GetComponent<InputController>();

        if( inputController == null )
        {
            Debug.LogError( "No input controller on " + gameObject.name );
            enabled = false;
        }
    }
 void Awake()
 {
     if (instance == null) {
         instance = this;
     } else if (instance != this){
         DestroyImmediate(this);
     }
     controlsDict = new Dictionary<string, string[]> ();
     defaultValues ();
 }
	void Start(){
		input = InputController.main;
		if (visibility == null){
			visibility = GetComponent<ObjectVisibility>();
		}
		GetComponent<Button>().onClick.AddListener(()=>{
			if (visibility.visible){
				input.invoke_dir(direction);
			}
		});
	}
示例#25
0
    private void internalIncrementPlayerScore( InputController.PlayerNumber player )
    {
        playerScores[ (int)player ]++;

        //check for win
        if( playerScores[ (int)player ] >= winScore )
        {
            latestWinner = (int)player;
            StateAgent.ChangeState( StateAgent.State.PostGame );
        }
    }
	void Awake(){
		main = this;
		if (direction_events == null) {
			direction_events = new Dictionary<string, UnityEvent> ();
		}
		if (direction_transitions == null) {
			direction_transitions = new Dictionary<string, List<Transition>> ();
		}
		if (went == null) {
			went = new Dictionary<string, bool> ();
		}
	}
示例#27
0
    // Use this for initialization
    void Start()
    {
        mainCamera.GetComponent<CameraController>().SetDragmode(true);

        inputController = inputObject.GetComponent<InputController>();
        glm = gameLevel.GetComponent<GameLevelManager>();

        glm.LoadMap("small2");

        mainCamera.rect = new Rect(0, 0, 1, 1);
        // minimapCamera.rect = new Rect(0.75f, 0.75f, 0.25f, 0.25f);
    }
示例#28
0
    // Use this for initialization
    void Start()
    {
        instance = this;
        inputController = new InputController();
        playerObj = GameObject.Find("Player");
        player = playerObj.GetComponent<Player>();

        map.initMap();
        map.mapGenerate();
        enemyGroup.init();
        enemyGroup.generateEnemy();
    }
示例#29
0
 // Use this for initialization
 void Start()
 {
     objectHistory = InfiniteObjectHistory.instance;
     objectManager = ObjectManager.instance;
     objectGenerator = ObjectGenerator.instance;
     inputController = InputController.instance;
     objectManager.Init();
     objectHistory.Init();
     objectGenerator.Init();
     objectGenerator.StartGame();
     inputController.StartGame();
 }
    // Use this for initialization
    void Start()
    {
        inputController = inputObject.GetComponent<InputController>();
        myCamera = GetComponent<Camera>();

        cameraCurrentPosition = myCamera.transform.position;
        cameraLastPosition = new Vector3(cameraCurrentPosition.x + 1, cameraCurrentPosition.y, cameraCurrentPosition.z);
        cameraCurrentZoomLevel = (int)myCamera.orthographicSize;
        cameraLastZoomLevel = cameraCurrentZoomLevel - 1;

        outlineParent = new GameObject();
        outlineParent.name = "Outlines";
    }
示例#31
0
        private void Kerko()
        {
            int      zgjedhja    = 0;
            bool     hapur       = this.optHapur.Checked;
            int      idKamarieri = 0;
            DateTime dtKerkimi   = System.DateTime.Today;
            string   strDesc     = "Turnet ";

            if (optHapur.Checked)
            {
                strDesc += "e hapura";
            }
            else
            {
                strDesc += "e mbyllura";
            }
            if (this.cbKamarieri.Checked == true)
            {
                idKamarieri = Convert.ToInt32(this.cmbKamarieri.Value);
                zgjedhja    = zgjedhja + 1;
                strDesc    += ", për kamarierin " + cmbKamarieri.Text;
            }

            if (this.cbData.Checked == true)
            {
                dtKerkimi = this.dtpData.Value;
                zgjedhja  = zgjedhja + 2;
                strDesc  += ", për datën " + dtpData.Text;
            }
            Doc.PageHeaderLeft = MDIAdminTjeter.emriRes + Environment.NewLine + strDesc;
            InputController data = new InputController();
            DataSet         ds   = data.KerkesaRead("ShfaqTurnetSipasKerkimit", zgjedhja, hapur, idKamarieri, dtKerkimi);

            if (ds != null)
            {
                this.gridTurnet.DataSource = ds.Tables[0];
            }
        }
示例#32
0
        private void btnFshi_Click(object sender, EventArgs e)
        {
            int indeksi = this.grida.Row;

            if (indeksi < 0)
            {
                return;
            }

            bool zgjedhur = Convert.ToBoolean(this.grida.GetRow(indeksi).Cells["ZGJEDHUR"].Text);

            if (zgjedhur == true)
            {
                MessageBox.Show(this, "Ju nuk mund te fshini grupin e cmimeve qe eshte ne perdorim !", "Kujdes !", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            DialogResult result = MessageBox.Show(this, "Ju jeni duke fshire nje grup cmimesh. Jeni te sigurte se doni te vazhdoni ?", "Vemendje !", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (result == DialogResult.No)
            {
                return;
            }

            InputController data = new InputController();

            int idGrupi = Convert.ToInt32(this.grida.GetRow(indeksi).Cells[0].Text);

            int b = data.KerkesaUpdate("FshiGrupCmimi", idGrupi);

            if (b != 0)
            {
                MessageBox.Show(this, "Nje gabim ndodhi ne fshirjen e grupit te cmimeve " + Environment.NewLine + "Ju lutem provoni perseri !", "Vemendje !", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            this.MbushGriden();
        }
示例#33
0
    void Update()
    {
        base.Update();

        if (!canRun)
        {
            return;
        }

        if (up && LIALight.intensity < 0.6f)
        {
            LIALight.intensity += Time.deltaTime / 2;
        }
        else
        {
            up = false;
            if (LIALight.intensity > 0.1f)
            {
                LIALight.intensity -= Time.deltaTime / 4;
            }
            else
            {
                up = true;
            }
        }

        //Pressing Esc will exit the state
        if (InputController.ReturnInput())
        {
            ExitState();
        }

        if (checkWhatCompoundCanvas.GetComponentInChildren <InputField> ().isFocused == true ||
            checkMolarityValueCanvas.GetComponentInChildren <InputField>().isFocused == true)
        {
            gameController.GetComponent <HUDController> ().LockKeys(true);
        }
    }
示例#34
0
    public void Initialize(InputController iController, int pId, Transform carryingPivot)
    {
        base.Awake();

        inputController    = iController;
        playerId           = pId;
        carryingItem       = null;
        playerActionState  = EPlayerActionState.IDLE;
        this.carryingPivot = carryingPivot;

        PlayerInputConfig inputConfig = new PlayerInputConfig();

        if (!AppConstant.Instance.isMultiPlayer)
        {
            inputConfig.horizontalAxis = InputAxisEnum.SinglePlayerHorizontal.Value;
            inputConfig.verticalAxis   = InputAxisEnum.SinglePlayerVertical.Value;
            inputConfig.actionButton   = InputAxisEnum.SinglePlayerAction.Value;
        }
        else
        {
            if (IsFirstPlayer())
            {
                inputConfig.horizontalAxis = InputAxisEnum.Player1_Horizontal.Value;
                inputConfig.verticalAxis   = InputAxisEnum.Player1_Vertical.Value;
                inputConfig.actionButton   = InputAxisEnum.Player1_Action.Value;
            }
            else
            {
                inputConfig.horizontalAxis = InputAxisEnum.Player2_Horizontal.Value;
                inputConfig.verticalAxis   = InputAxisEnum.Player2_Vertical.Value;
                inputConfig.actionButton   = InputAxisEnum.Player2_Action.Value;
            }
        }

        inputController.inputConfig = inputConfig;

        nearbyInteractiveGameObjects = new HashSet <GameObject>();
    }
示例#35
0
        private void btnFshi_Click(object sender, EventArgs e)
        {
            DataSet dsId = new DataSet();

            dsId.Tables.Add();
            dsId.Tables[0].Columns.Add("ID_SHPENZIMI", typeof(Int32));
            dsId.AcceptChanges();
            for (int i = 0; i < gridShpenzimet.RowCount; i++)
            {
                if (gridShpenzimet.GetRow(i).Cells["CHECKED"].Text == "True")
                {
                    DataRow r = dsId.Tables[0].NewRow();
                    r["ID_SHPENZIMI"] = Convert.ToInt32(gridShpenzimet.GetRow(i).Cells["ID_SHPENZIMI"].Text);
                    dsId.Tables[0].Rows.Add(r);
                }
            }
            dsId.AcceptChanges();
            if (dsId.Tables[0].Rows.Count != 0)
            {
                InputController data = new InputController();
                int             b    = data.KerkesaUpdate("FshiShpenzimet", dsId);
                if (b != 0)
                {
                    MessageBox.Show(this, "Një gabim ndodhi gjatë fshirjes së shpenzimeve!" + Environment.NewLine +
                                    "Provoni përsëri!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                //jane fshire te gjithe shpenzimet dhe gjate fshirjes
                //nuk ka patur konflikte
                else
                {
                    MessageBox.Show(this, "Shpenzimet e zgjedhur u fshinë.",
                                    this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    Kerko();
                    return;
                }
            }
        }
示例#36
0
        public override void StartGame()
        {
            if (playerLives < 1)
            {
                playerLives = DEFAULT_PLAYER_LIVES;
            }

            var controls = new Dictionary <string, string>
            {
                { "Fire", "Fire1" },
                { "Horizontal", "Horizontal1" },
                { "Vertical", "Vertical1" }
            };

            var playerObject = spawnManager.SpawnPlayer(this, new Vector2(0, -3));

            InputController.AssignPlayerControls(playerObject.GetInstanceID(), controls);

            ResetStats();
            spawnManager.StartSpawn(this);
            gameView.ShowHighScore(GetHighscore().ToString());
            base.StartGame();
        }
示例#37
0
    protected virtual void OnDragEnd(InputController inputController)
    {
        //TODO:SZ - refactor
        m_IsDragging = false;

        var totalDragWorld    = GetTotalWorldDragDiff();
        var absTotalDragWorld = Mathf.Abs(totalDragWorld);

        if (absTotalDragWorld < m_DragWorldToSwitchOffset)
        {
            return;
        }

        if (totalDragWorld > 0.0f)
        {
            --CurrentDragZoneElementIndex;
        }
        else
        {
            ++CurrentDragZoneElementIndex;
        }
        CalculateDragZoneElementIndex();
    }
示例#38
0
 // Update is called once per frame
 void Update()
 {
     if (InputController.HasTouchBegan())
     {
         ray = Camera.main.ScreenPointToRay(InputController.GetTouchPosition());
         if (Physics.Raycast(ray, out hit))
         {
             if (hit.collider.name.Equals(play.name))
             {
                 gc.Pause();
             }
             else if (hit.collider.name.Equals(mute.name))
             {
                 Mute();
             }
             else if (hit.collider.name.Equals(home.name))
             {
                 Application.LoadLevel(0);
                 Time.timeScale = 1.0f;
             }
         }
     }
 }
示例#39
0
    void Start()
    {
        //GET
        inputControl       = GetComponent <InputController>();
        uiController       = GetComponent <UIController>();
        cameraController   = Camera.main.GetComponent <CameraBehaviour>();
        timerController    = GetComponentInChildren <TimerController>();
        resourceController = GetComponentInChildren <ResourceController>();
        //GET Managers
        buildingsManager = FindObjectOfType <CentroDeRetencion>();
        inmigrantManager = FindObjectOfType <InmigrantManager>();
        policeManager    = FindObjectOfType <PoliceManager>();

        //SET Controllers
        inputControl.SetUp(ref globalState);
        uiController.SetUP();
        timerController.SetUP();
        resourceController.SetUp();
        //Set Managers
        buildingsManager.SetUP();
        inmigrantManager.SetUp();
        policeManager.SetUp();
    }
示例#40
0
    public override void OnStartLocalPlayer()
    {
        base.OnStartLocalPlayer();

        inputController = GameObject.FindWithTag("InputController").GetComponent <InputController>();
        if (inputController == null)
        {
            return;
        }

        inputController.SetLobbyEnabled(false);

        Camera playerCamera = GetComponentInChildren <Camera>();

        playerCamera.enabled = true;
        AudioListener audioListener = playerCamera.GetComponent <AudioListener>();

        if (audioListener != null)
        {
            audioListener.enabled = true;
        }
        inputController.mainCamera = playerCamera;
    }
示例#41
0
    public void Score()
    {
        score++;
        UIController.DisplayInfo("Material Block: " + score.ToString() + "/" + maxScore.ToString());

        if (score >= maxScore)
        {
            switch (level)
            {
            case 1:
                // TODO: Load Cons Level Here
                EnableRocketJump(250);
                break;

            case 2:
                InputController.Instance().xEnable = true;
                break;

            case 3:
                break;
            }
        }
    }
示例#42
0
    private void Awake()
    {
        SavedKeyCodes = new KeyCode[KeyCodes.Length];
        //para testear joysticks
        Joystick = true;


        // Debug.Log("entro1");
        if (instance == null)
        {
            instance = this;
        }
        else
        {
            Destroy(gameObject);
        }
        Keys = new Dictionary <string, KeyCode>();
        for (int C = 0; C < KeyCodes.Length; C++)
        {
            Keys.Add(KeyNames[C], KeyCodes[C]);
            // Debug.Log("entro");
        }
    }
示例#43
0
        private void MbushFavorite()
        {
            InputController data = new InputController();
            DataSet         ds   = data.KerkesaRead("ShfaqFavorite");

            this.dsFavorite.Tables[0].Rows.Clear();

            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                DataRow drFav = this.dsFavorite.Tables[0].NewRow();

                drFav["ID_FAVORITE"] = dr["ID_FAVORITE"];

                drFav["EMRI"]       = dr["EMRI"];
                drFav["LLOJI"]      = dr["LLOJI"];
                drFav["PRIORITETI"] = dr["PRIORITETI"];
                drFav["CHECKED"]    = false;

                this.dsFavorite.Tables[0].Rows.Add(drFav);
            }

            this.dsFavorite.Tables[0].AcceptChanges();
        }
示例#44
0
    public void UIControllerSetup()
    {
        GameController        = GameObject.Find("GameController").GetComponent <GameController> ();
        inputController       = GameObject.Find("InputController").GetComponent <InputController>();
        playerResourceManager = WorldMethods.GetPlayerResourceManager();

        pauseBoard = GameObject.Find("PauseBoard");

        GameSpeedDisplay = GameObject.Find("GameSpeedDisplay").GetComponent <TextMeshProUGUI> ();
        DaysCounter      = GameObject.Find("DaysCounter").GetComponent <TextMeshProUGUI>();
        MonthsCounter    = GameObject.Find("MonthsCounter").GetComponent <TextMeshProUGUI>();
        YearsCounter     = GameObject.Find("YearsCounter").GetComponent <TextMeshProUGUI>();

        authorityNumber  = GameObject.Find("AuthorityNumber").GetComponent <TextMeshProUGUI>();
        populationNumber = GameObject.Find("PopulationNumber").GetComponent <TextMeshProUGUI>();
        foodNumber       = GameObject.Find("FoodNumber").GetComponent <TextMeshProUGUI>();
        woodNumber       = GameObject.Find("WoodNumber").GetComponent <TextMeshProUGUI>();
        silverNumber     = GameObject.Find("SilverNumber").GetComponent <TextMeshProUGUI>();

        seasonManager = WorldMethods.GetSeasonManager();

        RealDate = GameController.RealDate;
    }
示例#45
0
        private void MbushGridenArtikujtFirst()
        {
            InputController data = new InputController();
            DataSet         ds   = data.KerkesaRead("ShfaqArtikujt");

            //this.gridArtikujt.DataSource = ds.Tables[0];

            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                DataRow drNew = this.dsArtikujt.Tables[0].NewRow();

                drNew["ID_KATEGORIAARTIKULLI"] = dr["ID_KATEGORIAARTIKULLI"];
                drNew["PERSHKRIMI"]            = dr["PERSHKRIMI"];
                drNew["ID_ARTIKULLI"]          = dr["ID_ARTIKULLI"];
                drNew["EMRI"]   = dr["EMRI"];
                drNew["NJESIA"] = dr["NJESIA"];
                drNew["SASIA"]  = 0;

                this.dsArtikujt.Tables[0].Rows.Add(drNew);
            }

            this.dsArtikujt.Tables[0].AcceptChanges();
        }
示例#46
0
    void Start()
    {
        inputControl = scriptManager.GetScript <InputController>();
        Inventory    = scriptManager.GetScript <Inventory>();
        OilSprite    = scriptManager.GetScript <HFPS_GameManager>().OilRemaining.GetComponent <Image>();
        switcherID   = switcher.GetIDByObject(gameObject);

        UIFader.SetColor(OilSprite.color);

        anim[DrawAnim].speed   = DrawSpeed;
        anim[HideAnim].speed   = HideSpeed;
        anim[ReloadAnim].speed = ReloadSpeed;

        defaultOilPercentagle  = oilPercentage;
        fullIntnesity          = LanternLight.intensity;
        oldIntensity           = LanternLight.intensity;
        reduceIntensity        = LanternLight.intensity;
        FlameTint              = LanternLight.transform.GetChild(0).GetComponent <MeshRenderer>().material.GetColor("_TintColor");
        FlameTint.a            = 0f;
        LanternLight.intensity = 0f;
        currentSprite          = spritePrefix + oilPercentage;
        reductionFactor        = oilPercentage - lightReductionRate;
    }
示例#47
0
        private void MbushGride(string s, string lloji, string koment)
        {
            InputController data    = new InputController();
            DataSet         dsXhiro = new DataSet();

            if (lloji == "artikujt")
            {
                dsXhiro = data.KerkesaRead("XhirojaPerSecilenDateSipasArtikujve", s);
            }
            else if (lloji == "recetat")
            {
                dsXhiro = data.KerkesaRead("XhirojaPerSecilenDateSipasRecetave", s);
            }
            gridXhiro.DataSource = dsXhiro.Tables[0];
            dsXhiro.Tables.Add("KOMENT_RAPORTI");
            dsXhiro.Tables[1].Columns.Add("KOMENT", typeof(string));
            DataRow newR = dsXhiro.Tables[1].NewRow();

            newR["KOMENT"] = koment;
            dsXhiro.Tables[1].Rows.Add(newR);
            dsXhiro.AcceptChanges();
            dsXhiro.WriteXml(Global.stringXml + "\\xhiroSipasArtikujveRecetave.Xml", XmlWriteMode.WriteSchema);
        }
示例#48
0
    void OnTriggerStay(Collider hit)
    {
        if (hit.CompareTag("Player"))
        {
            player  = hit.GetComponent <PlayerController>();
            control = hit.GetComponent <InputController>();

            //if in shooting and i don't have a bullet
            if (control.isFiring() && player.carrying == false)
            {
                //if the pickup is grabbable
                if (isPickUppable)
                {
                    player.SetShouldCarry(true, bullet, null, bulletType, bulletIcon);
                }

                renderer.enabled   = false;
                myCollider.enabled = false;
                isPickUppable      = false;
                takeItMoment       = Time.time;
            }
        }
    }
示例#49
0
文件: OldGM.cs 项目: saporter/Jascity
    private bool notepadOn = false;   // an admin flag that turns the notepad back on once off

    private void Awake()
    {
        Racing            = false;
        Finished          = false;
        startCameraPos    = Camera.main.transform.position;
        startCameraRot    = Camera.main.transform.rotation;
        startCameraSize   = Camera.main.orthographicSize;
        startCameraParent = Camera.main.transform.parent;
        startPos          = transform.position;
        startRotation     = transform.rotation;
        timer             = GetComponent <Timer>();
        input             = GetComponent <InputController>();
        pathNodes         = new List <Transform>(RacingPathNodesParent.GetComponentsInChildren <Transform>());
        pathNodes.Remove(RacingPathNodesParent.transform);
        currentPosition           = 0;
        originalStartAreaPosition = StartAreaGameObject.transform.position;

        if (Instance != null)
        {
            Debug.LogError("Two GameManagers in scene");
        }
        Instance = this;
    }
示例#50
0
    public virtual void Ended(InputController c)
    {
        if (m_ParticleSpawned != null)
        {
            if (activatedParticle.main.loop)
            {
                Destroy(m_ParticleSpawned.gameObject);
            }
        }

        if (activatedSound != null && c.powerupSource.clip == activatedSound)
        {
            c.powerupSource.Stop(); //if this one the one using the audio source stop it
        }
        for (int i = 0; i < c.consumables.Count; ++i)
        {
            if (c.consumables[i].active && c.consumables[i].activatedSound != null)
            {//if there is still an active consumable that have a sound, this is the one playing now
                c.powerupSource.clip = c.consumables[i].activatedSound;
                c.powerupSource.Play();
            }
        }
    }
示例#51
0
    protected void Init()
    {
        GameplayManager      = GameClient.Get <IGameplayManager>();
        TutorialManager      = GameClient.Get <ITutorialManager>();
        BoardArrowController = GameplayManager.GetController <BoardArrowController>();
        InputController      = GameplayManager.GetController <InputController>();

        _selfObject = gameObject;

        TargetObjectsGroup   = _selfObject.transform.Find("Group_TargetObjects").gameObject;
        RootObjectsGroup     = _selfObject.transform.Find("Arrow/Group_RootObjects").gameObject;
        ArrowObject          = _selfObject.transform.Find("Arrow").gameObject;
        TargetColliderObject = _selfObject.transform.Find("Target_Collider").gameObject;

        if (_isInverse)
        {
            _selfObject.transform.localScale = new Vector3(-1, 1, 1);
        }

        InputController.PlayerSelectingEvent   += PlayerSelectingEventHandler;
        InputController.UnitSelectingEvent     += UnitSelectingEventHandler;
        InputController.NoObjectsSelectedEvent += NoObjectsSelectedEventHandler;
    }
示例#52
0
        private void KonsumoArtikujtBanaku(int idFatura)
        {
            InputController data = new InputController();
            DataSet         ds   = data.KerkesaRead("KtheArtikujtPerFature", idFatura);

            int nr = ds.Tables[0].Rows.Count;

            int    idArtikulli = 0;
            double sasia       = 0;
            string strSasia    = "";

            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                idArtikulli = Convert.ToInt32(dr["CELESI"]);

                strSasia = Convert.ToDouble(dr["SASIA"]).ToString("0.00");
                sasia    = Convert.ToDouble(strSasia);
                this.ModifikoSasiaArtikull(idArtikulli, sasia);
            }

            this.dsArtikujtBanaku.Tables[0].AcceptChanges();
            this.dsArtikujtBanaku.WriteXml("C:\\Program Files\\VisionInfoSolution\\RestaurantManager\\Raportet\\Banaku.xml");
        }
    public override void OnInspectorGUI()
    {
        // in case more public variables are added, be able to use default editor view
        showDefault = EditorGUILayout.Toggle(new GUIContent("Default Editor", "Select to use Unity's default inspector/editor"), showDefault);
        if (showDefault)
        {
            base.OnInspectorGUI();
            return;
        }

        InputController ic = (InputController)target;

        Environment environment = ic.Environment;

        ic.controlMode = (ControlMode)EditorGUILayout.EnumPopup(
            new GUIContent("Control Mode", "Selecting Controller still allows Keyboard inputs"), ic.controlMode);

        if (ic.controlMode == ControlMode.Controller)
        {
            ic.controllerType = (ControllerType)EditorGUILayout.EnumPopup(
                new GUIContent("Controller Type", "Why are you looking at me? I have nothing to say!"), ic.controllerType);
        }
    }
示例#54
0
    // Use this for initialization
    void Start()
    {
        grid           = GameObject.Find("MainController").GetComponent <GridController>();
        ioController   = GameObject.Find("MainController").GetComponent <InputController>();
        mainCam        = GameObject.Find("MainController").GetComponent <MainCameraController>();
        animator       = this.GetComponent <Animator>();
        m              = this.GetComponent <Renderer>().material;
        pathIndicators = new Queue <GameObject>();

        drunk       = false;
        high        = false;
        pathfinding = false;

        transform.localScale = new Vector3(-1.0f, 1.0f, 0.0f);

        currentSpeed        = defaultSpeed;
        fadeSpeed           = 2.0f;
        normalMaterial      = new Material(m);
        alphaMaterial       = new Material(m);
        tempColor           = m.color;
        tempColor.a         = 0.0f;
        alphaMaterial.color = tempColor;
    }
示例#55
0
    void Update()
    {
        float control;

        InputController.Update();

        control = InputController.GetAxis(InputController.Axis.Cross_Horizontal);

        if (control != 0)
        {
            move.x = control;
        }
        else
        {
            move.x = Input.GetAxis("Horizontal");
        }

        if (Input.GetKeyDown(KeyCode.R) || Input.GetKeyDown(KeyCode.Joystick1Button0))
        {
            int sceneIndex = SceneManager.GetActiveScene().buildIndex;
            SceneManager.LoadScene(sceneIndex);
        }
    }
示例#56
0
    // Update is called once per frame
    protected void Update()
    {
        int tDirection = Mathf.RoundToInt(InputController.GetInput(InputController.Directions.MoveY));

        mAnimator.SetInteger("Direction", tDirection);
        Quaternion tRotation = Quaternion.Euler(0, 0, -InputController.GetInput(InputController.Directions.MoveX) * 180f * Time.deltaTime);

        transform.rotation *= tRotation;
        if (mCoolDown > 0f)
        {
            mCoolDown -= Time.deltaTime;
        }
        if (mCoolDown <= 0f)
        {
            if (InputController.GetInput(InputController.Directions.Fire) > 0f)
            {
                mCoolDown = CoolDown;
                GameObject tShellGO = Instantiate(ShellPrefab);
                tShellGO.transform.rotation = transform.rotation;
                tShellGO.transform.position = transform.position + transform.rotation * (Vector2.up * 0.5f);
            }
        }
    }
示例#57
0
 public override void Init(SignalBus signalBus,
                           Container.Cloud cloud,
                           StateController <RunTimeState> runTimeStateController,
                           InputController inputController,
                           AudioController audioController,
                           VideoController videoController,
                           MonoBehaviour monoBehaviour,
                           SceneManager.SceneManager sceneManager,
                           SpawnController spawnController,
                           CompanyData companyData)
 {
     this.signalBus = signalBus;
     this.cloud     = cloud;
     this.runTimeStateController = runTimeStateController;
     this.inputController        = inputController;
     this.audioController        = audioController;
     this.videoController        = videoController;
     this.sceneManager           = sceneManager;
     this.spawnController        = spawnController;
     this.monoBehaviour          = monoBehaviour;
     this.companyData            = companyData;
     this.customerGenerator      = new CustomerGenerator();
 }
示例#58
0
    private void InputController_OnAxisChanged(Axis axis, float value, InputController controller)
    {
        switch (axis)
        {
        //Change character with left stick (left and right) or A/D/Left/Right
        case Axis.MoveHorizontal:
            if (!IsReady)
            {
                horizontalValue = value;
                if (Mathf.Abs(horizontalValue) != 1)
                {
                    return;
                }

                if (!hasChanged)
                {
                    StopAllCoroutines();
                    StartCoroutine(ChangeCharacter((int)horizontalValue));
                }
            }
            break;
        }
    }
    void Start()
    {
        inputController   = GetComponent <InputController>();
        controller        = GetComponent <Controller2D>();
        triggerController = GetComponent <TriggerCollisionsController>();
        playerAnimInfo    = GetComponent <PlayerAnimInfo>();
        pv            = GetComponent <PhotonView>();
        dogController = GetComponent <DogController>();

        playerGanhou = Resources.Load <BoolVariable>("PlayerGanhou");
        textoAtivo   = Resources.Load <BoolVariable>("TextoAtivo");

        CalculateJumpStats();

        //Utilizado para fazer os sons dos passos tocarem
        InvokeRepeating("CallFootsteps", 0, 0.3f);
        playerGanhou.Value = false;

        if (moveSpeed.Value != 6)
        {
            moveSpeed.Value = 6;
        }
    }
    IEnumerator MoveCamera()
    {
        float t = 0.0f;

        while (t <= 1.0)
        {
            t += Time.deltaTime / cameraMoveSeconds;
            float v = t;
            v = EasingFunction.EaseInOutQuad(0.0f, 1.0f, t);
            Vector3 newPosition = Vector3.Lerp(startPos, endPos, v);

            Vector2 pixelPerfectMoveAmount = Utils.MakePixelPerfect(newPosition);
            Vector3 newPos = new Vector3(pixelPerfectMoveAmount.x, pixelPerfectMoveAmount.y, Camera.main.transform.position.z);
            Camera.main.transform.position = newPos;

            yield return(new WaitForEndOfFrame());
        }
        if (!inDialogue)
        {
            CameraFollow.GetInstance().enabled             = true;
            InputController.GetInstance().moveInputEnabled = true;
        }
    }