コード例 #1
0
    // Start is called before the first frame update
    void Awake()
    {
        rb              = GetComponent <Rigidbody2D>();
        sr              = GetComponent <SpriteRenderer>();
        anim            = GetComponent <Animator>();
        bc              = GetComponent <BoxCollider2D>();
        controlsManager = FindObjectOfType <ControlsManager>();
        //get all colliders attached to player
        hitboxes = new List <Collider2D>(GetComponentsInChildren <BoxCollider2D>());
        //get the hitboxes
        List <Collider2D> acceptableColliders = new List <Collider2D>();

        foreach (BoxCollider2D bc in hitboxes)
        {
            if (bc.gameObject.CompareTag("HitBox"))
            {
                acceptableColliders.Add(bc);
            }
        }
        hitboxes = acceptableColliders;

        //get the other player
        GameObject[] players = GameObject.FindGameObjectsWithTag("Player");
        Debug.Log(players.Length);
        foreach (GameObject player in players)
        {
            //if their player ids dont match then it is the other player
            if (PlayerID != player.GetComponent <PlayerControls>().PlayerID)
            {
                otherPlayer = player;
            }
        }
    }
コード例 #2
0
    void GrabControls()
    {
        if (!ActivityManager.Instance)
        {
            return;
        }

        //Store the controls manager
        ControlsManager mgr = ActivityManager.Instance.HUDController;

        if (mgr)
        {
            loadedControls = ActivityManager.Instance.HUDController.LoadedControls;
        }

        if (loadedControls)
        {
            //When we grab... hide all the controls...
            loadedControls.Shoot.gameObject.SetActive(false);
            loadedControls.Shield.gameObject.SetActive(false);
            loadedControls.Overheat.gameObject.SetActive(false);
        }


        //Take the hud off when we grab.
        ActivityManager.Instance.ToggleHud(false);
    }
コード例 #3
0
        private void    Init()
        {
            ChangeFormDimensions();

            CountryCMB.SelectedIndex = 0;

            IsInitialized  = true;
            DoubleBuffered = true;

            CurrentActiveYear = Config.LastYear;
            GraphicsPB.Left   = 0;
            GraphicsPB.Height = 960;
            GraphsPanel.Controls.Add(GraphicsPB);

            FetchedClubs  = FetchedClubs ?? new List <ClubHistory>();
            SelectedClubs = SelectedClubs ?? new Dictionary <int, ClubHistory>();
            TableMarkup.Initialize(GraphicsPB);
            ControlsManager.Initialize(YearsLbl, YearsLbl2);
            CriteriaCMB.SelectedIndex = 0;

            for (var i = Config.FirstYear; i <= Config.LastYear; i++)
            {
                SeasonYearCMB.Items.Add("         Season  " + (i - 1) + " / " + i);
            }
        }
コード例 #4
0
 public void OnUngrab(GameObject go)
 {
     if (whileHeldOnly)
     {
         ControlsManager.RemoveControl(go.name.Contains("Left") ? (ControlName)((int)controlButton - 1) : controlButton, this);
     }
 }
コード例 #5
0
 // Use this for initialization
 void Start()
 {
     unitManager     = GameObject.Find("UnitManager").GetComponent <UnitManager>();
     controlsManager = GameObject.Find("ControlsManager").GetComponent <ControlsManager>();
     map             = new MapTile[mapWidth, mapHeight];
     MapSetup();
 }
コード例 #6
0
    private void Awake()
    {
        DontDestroyOnLoad(this);

        Instance = this;

        KeyCode KeyForward;
        KeyCode KeyBackward;
        KeyCode KeyLeft;
        KeyCode KeyRight;
        KeyCode KeyJump;
        KeyCode KeySneak;
        KeyCode KeySprint;
        KeyCode KeyBlockBreak;
        KeyCode KeyBlockPlace;
        int     RenderDistance;
        int     Fov;

        Enum.TryParse(PlayerPrefs.GetString("KeyForward", "W"), out KeyForward);
        Enum.TryParse(PlayerPrefs.GetString("KeyBackward", "S"), out KeyBackward);
        Enum.TryParse(PlayerPrefs.GetString("KeyLeft", "A"), out KeyLeft);
        Enum.TryParse(PlayerPrefs.GetString("KeyRight", "D"), out KeyRight);
        Enum.TryParse(PlayerPrefs.GetString("KeyJump", "Space"), out KeyJump);
        Enum.TryParse(PlayerPrefs.GetString("KeySneak", "LeftShift"), out KeySneak);
        Enum.TryParse(PlayerPrefs.GetString("KeySprint", "LeftControl"), out KeySprint);
        Enum.TryParse(PlayerPrefs.GetString("KeyBlockBreak", "Mouse0"), out KeyBlockBreak);
        Enum.TryParse(PlayerPrefs.GetString("KeyBlockPlace", "Mouse1"), out KeyBlockPlace);

        RenderDistance = PlayerPrefs.GetInt("RenderDistance", 10);
        Fov            = PlayerPrefs.GetInt("Fov", 60);

        settings = new Settings(KeyForward, KeyBackward, KeyLeft, KeyRight, KeyJump, KeySneak, KeySprint, KeyBlockBreak, KeyBlockPlace, RenderDistance, Fov);
    }
コード例 #7
0
        public CommonForm()
        {
            fComponents = new Container();
            fToolTip    = new ToolTip(this.fComponents);

            fControlsManager = new ControlsManager();
        }
コード例 #8
0
 private void Start()
 {
     this.characterMotor  = this.GetComponent <CharacterMotor>();
     this.controlsManager = (ControlsManager)Object.FindObjectOfType(typeof(ControlsManager));
     this.controlsManager.moveForward.stateChanged          += delegate(float amount) { this.characterMotor.MoveZ(amount); };
     this.controlsManager.moveBackward.stateChanged         += delegate(float amount) { this.characterMotor.MoveZ(-amount); };
     this.controlsManager.moveRight.stateChanged            += delegate(float amount) { this.characterMotor.MoveX(amount); };
     this.controlsManager.moveLeft.stateChanged             += delegate(float amount) { this.characterMotor.MoveX(-amount); };
     this.controlsManager.speedUp.stateChanged              += delegate(float amount) { this.characterMotor.SpeedUp(amount); };
     this.controlsManager.turn.stateChanged                 += delegate(float amount) { this.characterMotor.Turn(amount); };
     this.controlsManager.look.stateChanged                 += delegate(float amount) { this.characterMotor.Look(amount); };
     this.controlsManager.jump.stateChanged                 += delegate(float amount) { this.characterMotor.Jump(amount); };
     this.controlsManager.sit.stateChanged                  += delegate(float amount) { this.characterMotor.Sit(); };
     this.controlsManager.stand.stateChanged                += delegate(float amount) { this.characterMotor.Stand(); };
     this.controlsManager.pickItem.stateChanged             += delegate(float amount) { this.Pick(); };
     this.controlsManager.throwItem.stateChanged            += delegate(float amount) { this.Throw(); };
     this.controlsManager.useItem.stateChanged              += delegate(float amount) { this.UseItem(); };
     this.controlsManager.useItemAlternatively.stateChanged += delegate(float amount) { this.UseItemAlternatively(); };
     this.controlsManager.switchItem.stateChanged           += delegate(float amount) { if (amount > 0)
                                                                                        {
                                                                                            this.NextItem();
                                                                                        }
                                                                                        if (amount < 0)
                                                                                        {
                                                                                            this.PreviousItem();
                                                                                        }
     };
     this.controlsManager.switchUsageMode.stateChanged += delegate(float amount) { this.SwitchUsageMode(); };
     this.controlsManager.switchItemMode.stateChanged  += delegate(float amount) { this.SwitchItemMode(); };
 }
コード例 #9
0
 // Use this for initialization
 void Start()
 {
     car             = FindObjectOfType <CarController2>();
     arduino         = FindObjectOfType <ArduinoConnectorScriptCar2>();
     rb              = GetComponent <Rigidbody>();
     controlsManager = FindObjectOfType <ControlsManager>();
 }
コード例 #10
0
    public bool RefineMentTest(int halfedge)
    {
        ExtrudableMesh _extrudableMesh = modellingObject.GetComponentInChildren <ExtrudableMesh>();
        Manifold       manifold        = _extrudableMesh._manifold;

        if (manifold.IsHalfedgeInUse(halfedge))
        {
            int h2 = manifold.GetNextHalfEdge(halfedge);
            h2 = manifold.GetNextHalfEdge(h2);

            if (manifold.IsHalfedgeInUse(h2))
            {
                int v1     = _extrudableMesh._manifold.SplitEdge(halfedge);
                int v2     = _extrudableMesh._manifold.SplitEdge(h2);
                int output = _extrudableMesh._manifold.SplitFaceByEdges(manifold.GetIncidentFace(halfedge), v1, v2);
                _extrudableMesh.UpdateMesh();

                ControlsManager man = modellingObject.GetComponentInChildren <Controls.ControlsManager>();
                man.UpdateControls();

                return(true);
            }
        }

        return(false);
    }
コード例 #11
0
    private void Awake()
    {
        if (CM == null)
        {
            DontDestroyOnLoad(gameObject);
            CM = this;
        }
        else if (CM != null)
        {
            Destroy(gameObject);
        }

        /*Assign each keycode when the game starts.
         * Loads data from PlayerPrefs so if a user quits the game,
         * their bindings are loaded next time. Default values
         * are assigned to each Keycode via the second parameter
         * of the GetString() function
         */

        up       = (KeyCode)System.Enum.Parse(typeof(KeyCode), PlayerPrefs.GetString("upKey", "W"));
        down     = (KeyCode)System.Enum.Parse(typeof(KeyCode), PlayerPrefs.GetString("downKey", "S"));
        left     = (KeyCode)System.Enum.Parse(typeof(KeyCode), PlayerPrefs.GetString("leftKey", "A"));
        right    = (KeyCode)System.Enum.Parse(typeof(KeyCode), PlayerPrefs.GetString("rightKey", "D"));
        interact = (KeyCode)System.Enum.Parse(typeof(KeyCode), PlayerPrefs.GetString("interactKey", "Space"));
    }
コード例 #12
0
    void Awake()
    {
        LevelIndex = Application.loadedLevel;
        instance = this;
        if (controlsManager == null) {
            GameObject newCM = new GameObject("Control_Manager");
            controlsManager = newCM.AddComponent<ControlsManager>();
            newCM.transform.SetParent(this.transform);
        }
        // GET THE SCORE MANAGER //
        if (scoreManager == null) {
            GameObject newScM = new GameObject("Score_Manager");
            scoreManager = newScM.AddComponent<ScoreManager>();
            newScM.transform.SetParent(this.transform);
        }

        // LETS SETUP A SCENE //
        if (sceneManager == null) {
            GameObject newSM = new GameObject("Scene_Manager");
            sceneManager = newSM.AddComponent<SceneManager>();
            newSM.transform.SetParent(this.transform);
        }
        // link the debugger //
        GameObject dbg = GameObject.Find ("Debugger");
        debugger = dbg.GetComponent<Debugger> ();
    }
コード例 #13
0
 // Use this for initialization
 void Start()
 {
     initialScale     = transform.localScale.x;
     _controlsManager = FindObjectOfType <ControlsManager>();
     _controlsManager.globalScaleChange += ControlsManagerOnGlobalScaleChange;
     ControlsManagerOnGlobalScaleChange(_controlsManager.globalScale);
 }
コード例 #14
0
 // Use this for initialization
 void Start()
 {
     this.state = this.GetComponent<ItemState>();
     this.gameManager = GameManager.GetMainGame().GetComponent<GameManager>();
     this.controls = gameManager.GetComponent<ControlsManager>();
     this.state.ReferenceName = Constants.Items.Hammer;
 }
コード例 #15
0
 void SetActiveProfile(int _index)
 {
     if (controlMan == null)
     {
         controlMan = FindObjectOfType <ControlsManager>();
     }
     controlMan.SetActiveProfile(GetNameFromProfileDropdown());
 }
コード例 #16
0
 public void OnGrab(GameObject go)
 {
     Debug.Log("Grab " + transform.name + ", " + actions.GetPersistentTarget(0));
     if (whileHeldOnly)
     {
         ControlsManager.AddControl(go.name.Contains("Left") ? (ControlName)((int)controlButton - 1) : controlButton, this);
     }
 }
コード例 #17
0
 void Awake()
 {
     if (CM == null)
     {
         CM = this;
     }
     controls = controlGameObject.GetComponent <Controls>();
 }
コード例 #18
0
ファイル: UnitManager.cs プロジェクト: ilfate/cardGame
    // Use this for initialization
    void Start()
    {
        this.initiativePanel = GameObject.Find("InitiativePanel");
        mapManager           = GameObject.Find("MapManager").GetComponent <MapManager>();
        controlsManager      = GameObject.Find("ControlsManager").GetComponent <ControlsManager>();

        CreateUnit(3, 3);
        //CreateUnit (1, 1);
    }
コード例 #19
0
    void Awake()
    {
        _interactableObjects     = new List <IInteractableObject>();
        controls                 = FindObjectOfType <ControlsManager>();
        controllerSphereCollider = transform.childCount > 0 ? transform.GetChild(0).GetComponent <SphereCollider>() : GetComponent <SphereCollider>();

        _meshRenderer = GetComponent <MeshRenderer>();
        defaultColor  = _meshRenderer.material.color;
    }
コード例 #20
0
ファイル: CommonForm.cs プロジェクト: PQYPLZXHGF/GEDKeeper
        public CommonDialog() : base()
        {
            Maximizable   = false;
            Minimizable   = false;
            Resizable     = false;
            ShowInTaskbar = false;

            fControlsManager = new ControlsManager();
        }
コード例 #21
0
    void Start()
    {
        this.game      = GameManager.GetMainGame();
        this.controls  = game.GetComponent <ControlsManager>();
        this.inventory = game.GetComponent <GameInventory>();

        this.render           = this.GetComponent <ItemRender>();
        this.itemCountManager = this.GetComponent <ItemCount>();
    }
コード例 #22
0
    private void Awake()
    {
        /// Persist managers between scenes
        DontDestroyOnLoad(gameObject);

        Controls = GetComponent <ControlsManager>();

        Controls.Startup();
    }
コード例 #23
0
    void SetActiveProfile(string _name)
    {
        if (controlMan == null)
        {
            controlMan = FindObjectOfType <ControlsManager>();
        }

        controlMan.SetActiveProfile(_name);
    }
コード例 #24
0
 // Use this for initialization
 private void Start()
 {
     _controlsManager        = GameObject.Find("GameManager").GetComponent <ControlsManager>();
     _boardManager           = GameObject.Find("GameManager").GetComponent <BoardManager>();
     _thisCollider           = GetComponent <Collider2D>();
     _thisCollider.enabled   = true;
     _spriteRenderer         = GetComponent <SpriteRenderer>();
     _spriteRenderer.enabled = false;
 }
コード例 #25
0
    IEnumerator AddListenerAfterFrame()
    {
        yield return(null);

        if (!whileHeldOnly)
        {
            ControlsManager.AddControl(controlButton, this);
        }
    }
コード例 #26
0
    private void Awake()
    {
        instance = this;

        inputActions = new ControlsManager();
        //When the input for rotating the camera is detected
        //Call function Rotate90deg()
        inputActions.Controls.RotateCamera.performed += context => Rotate90deg(context.ReadValue <float>());
    }
コード例 #27
0
ファイル: DataPanel.cs プロジェクト: Serg-Norseman/AquaMate
        public DataPanel()
        {
            BackColor   = SystemColors.Control;
            BorderStyle = BorderStyle.FixedSingle;
            Dock        = DockStyle.Fill;

            fActions         = new List <UserAction>();
            fControlsManager = new ControlsManager();
        }
コード例 #28
0
    void Start()
    {
        if (instance != null)
        {
            Debug.LogError("Error: Cannot have two ControlsManager");
        }

        instance = this;
    }
コード例 #29
0
 protected override void Initialize()
 {
     controlsManager = GetComponent <ControlsManager>();
     physics         = GetComponent <EntityMovePhysics>();
     if (bulletSpeed <= 0)
     {
         bulletSpeed = DEFAULT_PLAYER_BULLET_SPEED;
     }
     health = GameData.Singleton.GameOptionData.Health;
 }
コード例 #30
0
 private void Start()
 {
     this.controlsManager          = (ControlsManager)Object.FindObjectOfType(typeof(ControlsManager));
     this.rigidbody.useGravity     = false;
     this.rigidbody.freezeRotation = true;
     this.rigidbody.sleepVelocity  = 0.1f;
     this.eyes             = this.GetComponent <Character>().eyes;
     this.rotationVertical = this.eyes.transform.rotation.x;
     this.distanceToGround = collider.bounds.extents.y;
 }
コード例 #31
0
    protected override void Start()
    {
        base.Start();
        var renderer = this.GetComponent <SpriteRenderer>();

        this.HasFinished = true;
        this.Started     = true;
        this.controls    = gameManager.GetComponent <ControlsManager>();
        this.initialSize = this.RectTransform.sizeDelta;
    }
コード例 #32
0
ファイル: StageEnd.cs プロジェクト: andre-cabral/mobile-RTS
    void Awake()
    {
        controlsManager = GameObject.FindGameObjectWithTag(Tags.gameController).GetComponent<ControlsManager>();
        objectsToShowOnGameOver = GameObject.FindGameObjectsWithTag(Tags.gameOverObject);
        setObjectsToShowOnGameOver(false);

        objectsToShowOnGameWin = GameObject.FindGameObjectsWithTag(Tags.gameWinObject);
        setObjectsToShowOnGameWin(false);

        charactersOnMissionList = GameObject.FindGameObjectWithTag(Tags.charactersOnMissionList).GetComponent<CharactersOnMissionList>();
        availableCharactersList = GameObject.FindGameObjectWithTag(Tags.availableCharactersList).GetComponent<AvailableCharactersList>();
        charactersManager = GetComponent<CharactersManager>();
    }
コード例 #33
0
 void Awake()
 {
     instance = this;
 }
コード例 #34
0
    void Awake()
    {
        charactersManager = GameObject.FindGameObjectWithTag(Tags.gameController).GetComponent<CharactersManager>();
        GameObject[] buttons = GameObject.FindGameObjectsWithTag(Tags.characterSelectButton);
        characterSelectButtons = new CharacterSelectButton[buttons.Length];
        for(int i=0; i<buttons.Length; i++){
            characterSelectButtons[i] = buttons[i].GetComponent<CharacterSelectButton>();
        }

        if(charactersManager.getAllButtons() == null){
            charactersManager.setAllButtons(characterSelectButtons);
        }

        controlsManager = GameObject.FindGameObjectWithTag(Tags.gameController).GetComponent<ControlsManager>();

        button = GetComponent<Button>();
    }
コード例 #35
0
 void Awake()
 {
     controlsManager = GameObject.FindGameObjectWithTag(Tags.gameController).GetComponent<ControlsManager>();
 }