示例#1
0
    // Use this for initialization
    new void Start()
    {
        base.Start();
        A_T               = new List <Tile>();
        _Input            = Camera.main.GetComponent <Input_Manager>();
        _Input.EnemyView += Sight;
        Goal              = new Vector2(Random.Range(
                                            ((int)_Tile.SpawnPoint[0].x - 6) > 0 ? (int)_Tile.SpawnPoint[0].x - 6 : 0,
                                            ((int)_Tile.SpawnPoint[0].x + 7) >= _Tile.X ? _Tile.X - 1 : (int)_Tile.SpawnPoint[0].x + 7),
                                        Random.Range(
                                            ((int)_Tile.SpawnPoint[0].y - 6) > 0 ? (int)_Tile.SpawnPoint[0].y - 6 : 0,
                                            ((int)_Tile.SpawnPoint[0].y + 7) >= _Tile.Y ? _Tile.Y - 1 : (int)_Tile.SpawnPoint[0].y + 7));



        PLAYER = new List <Unit_Manager>();

        if (SEE_PLAYER == null)
        {
            SEE_PLAYER = new List <Unit_Manager>();
        }
        SEE_ALL += Seek;

        Watch_Stop = true;

        Behind_Ob = new List <Vector2Int>();
        Board_Manager.m_Board_Manager.Recive_Tactical += ReciveTactical;
        Health = 1;
    }
示例#2
0
 void Awake()
 {
     controls = new Input_Manager();
     instance = this;
     player   = GameObject.FindObjectOfType <Player>();
     npc      = GameObject.FindObjectOfType <Npc>();
     gameObject.SetActive(false);
 }
示例#3
0
    // Start is called before the first frame update
    void Start()
    {
        _Transform = GetComponent <RectTransform>();

        if (transform.childCount > 0)
        {
            _ChildTrans = transform.GetChild(0).GetComponent <RectTransform>();
        }
        _Input = Input_Manager.m_InputManager;
    }
示例#4
0
    // Start is called before the first frame update
    void Awake()
    {
        current = this;

        foreach (var input in input_list)
        {
            static_input.Add(input.name, input);
        }
        is_inited = true;
    }
示例#5
0
    // Update is called once per frame
    void Update()
    {
        //Get Input
        moveVertical   = Input_Manager.GetAxis("Move Vertical " + (playerNum + 1));
        moveHorizontal = Input_Manager.GetAxis("Move Horizontal " + (playerNum + 1));
        lookVertical   = Input_Manager.GetAxis("Look Vertical " + (playerNum + 1));
        lookHorizontal = Input_Manager.GetAxis("Look Horizontal " + (playerNum + 1));
        if (Input_Manager.GetAxisRaw("Move Vertical " + (playerNum + 1)) > 0 && previousMoveVertical == 0f)
        {
            if (Time.frameCount - lastTapFrame < 20)
            {
                RollForward();
            }
            else
            {
                lastTapFrame = Time.frameCount;
            }
        }
        previousMoveVertical = Input_Manager.GetAxisRaw("Move Vertical " + (playerNum + 1));
        if (Input.GetButton("Change Weapon " + (playerNum + 1)))
        {
            ChooseAttack(moveHorizontal, moveVertical);
        }
        if (Input.GetButton("Run " + (playerNum + 1)) && CheckGrounded())
        {
            movement.runMultiplier = 1.75f;
        }
        else
        {
            movement.runMultiplier = 1f;
        }

        if (Input.GetKeyDown("k"))
        {
            movement.LockOnEnemy();
        }

        //is input greater than 0

        else if (!rolling)
        {
            if (CheckGrounded() && Vector2.SqrMagnitude(new Vector2(moveHorizontal, moveVertical)) > 0.1f)
            {
                //Moves the player using velocities
                movement.Move(moveHorizontal, moveVertical);
            }
        }
        if (Input.GetButtonDown("Jump " + (playerNum + 1)) && CheckGrounded())
        {
            movement.Jump();
        }
        Attack();
        movement.AnimateMovement();
    }
 public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
 {
     if (Input_Manager.Exists())
     {
         SerializedProperty currentKeyIndex = property.FindPropertyRelative("currentKeyIndex");
         EditorGUI.BeginProperty(position, label, property);
         position = EditorGUI.PrefixLabel(position, GUIUtility.GetControlID(FocusType.Passive), label);
         currentKeyIndex.intValue = EditorGUI.Popup(position, currentKeyIndex.intValue, Input_Manager.instance.getKeyNames());
         EditorGUI.EndProperty();
     }
 }
示例#7
0
    void Awake()
    {
        controls = new Input_Manager();

        for (int i = 0; i < 5; i++)
        {
            Coin c = ScriptableObject.CreateInstance <Coin>();
            c.currencyType = (Coin.CurrencyTypes)i;
            coins.Add(c.currencyType, 0);
        }
    }
 private void Awake()
 {
     if (Exists() == false)
     {
         instance = this;
     }
     else if (instance != this)
     {
         Destroy(this.gameObject);
     }
     keys = keysList.ToArray();
 }
示例#9
0
    public static Input_Manager Instance()
    {
        if (!inputManager)
        {
            inputManager = FindObjectOfType(typeof(Input_Manager)) as Input_Manager;
            if (!inputManager)
            {
                Debug.LogError("There needs to be at least one GameObject with an Input_Manager script attached to it!");
            }
        }

        return(inputManager);
    }
示例#10
0
    // Use this for initialization
    protected new void Start()
    {
        base.Start();


        D_Action_Point  = UI_Manager.D_Action_Point;
        _Input          = Camera.main.GetComponent <Input_Manager>();
        _Input.EndTurn += EndTurn;

        View = GetComponent <View_Manager>();

        original = GetComponent <SpriteRenderer>().color;
    }
示例#11
0
    // Use this for initialization
    protected void Start()
    {
        Btn_Name[0] = "FIRE [3]";
        Btn_Name[1] = "AIMED SHOT [6]";
        Btn_Name[2] = "REROALD [3]";
        Btn_Name[3] = null;
        Btn_Name[4] = null;

        _Kind  = Kind.RIFLE;
        _Title = Title.Main;

        _Input = Camera.main.GetComponent <Input_Manager>();
        _UI    = GameObject.Find("Canvas").GetComponent <UI_MANAGER>();
    }
 private void checkRot()
 {
     if (axes == RotationAxis.MouseX)
     {
         transform.Rotate(0, Input_Manager.SecondaryHorizontal() * sensHorizontal, 0);
     }
     else if (axes == RotationAxis.MouseY)
     {
         _rotationX -= Input_Manager.SecondaryVertical() * sensVertical;
         _rotationX  = Mathf.Clamp(_rotationX, minimumVert, maximumVert);
         float rotationY = transform.localEulerAngles.y;
         transform.localEulerAngles = new Vector3(_rotationX, rotationY, 0);
     }
 }
示例#13
0
    // Use this for initialization
    protected void Start()
    {
        Btn_Name[0] = "FIRE 3 TIMES [3]";
        Btn_Name[1] = "HALF CLIP [6]";
        Btn_Name[2] = "FULL CLIP [6]";
        Btn_Name[3] = "RERLOAD [3]";
        Btn_Name[4] = null;

        _Kind  = Kind.SU_AR;
        _Title = Title.Main;

        _Input = Camera.main.GetComponent <Input_Manager>();
        _UI    = GameObject.Find("Canvas").GetComponent <UI_MANAGER>();
    }
示例#14
0
    // Update is called once per frame
    void Update()
    {
        Debug.DrawRay(transform.position, transform.forward * distanceToSee, Color.red);

        if (Physics.Raycast(transform.position, transform.forward, out hit, distanceToSee))
        {
            //Debug.Log("I hit " + hit.transform.name);
            Interactable inter = hit.collider.gameObject.GetComponent <Interactable>();
            if ((Input.GetKeyDown(KeyBindings.keys["Interact"]) || Input_Manager.XButton()) && inter != null)
            {
                inter.Interact();
            }
        }
    }
示例#15
0
    // Use this for initialization
    protected void Start()
    {
        Btn_Name[0] = "FIRE [3]";
        Btn_Name[1] = "AIMED SHOT [5]";
        Btn_Name[2] = null;
        Btn_Name[3] = null;
        Btn_Name[4] = null;

        _Kind  = Kind.HEAVY_WEAPON;
        _Title = Title.Sub;

        _Input = Camera.main.GetComponent <Input_Manager>();
        _UI    = GameObject.Find("Canvas").GetComponent <UI_MANAGER>();
    }
示例#16
0
    // Use this for initialization
    protected void Start()
    {
        Btn_Name[0] = "SET UP [4]";
        Btn_Name[1] = "CHANGE POS [5]";
        Btn_Name[2] = "SUPPRESION FIRE [4]";
        Btn_Name[3] = "FIRE [3]";
        Btn_Name[4] = "RELOAD [4]";

        _Kind  = Kind.HEAVY_MACHINE_GUN;
        _Title = Title.Main;

        _Input = Camera.main.GetComponent <Input_Manager>();
        _UI    = GameObject.Find("Canvas").GetComponent <UI_MANAGER>();
    }
示例#17
0
    // Update is called once per frame
    void Update()
    {
        if (Input_Manager.StartButton())
        {
            pause.SetActive(!pause.activeSelf);
            Camera_Control.paused = !Camera_Control.paused;
        }

        if (Input.GetKeyDown(KeyBindings.keys["Pause"]))
        {
            if (pause.activeInHierarchy)
            {
                if (optionsPanel.activeInHierarchy)
                {
                    optionsPanel.SetActive(false);
                }
                else
                {
                    pause.SetActive(false);
                    Camera_Control.paused = false;
                }
            }
            else if (journalPanel.activeInHierarchy)
            {
                journalPanel.SetActive(false);
                Camera_Control.paused = false;
            }
            else
            {
                pause.SetActive(true);
                Camera_Control.paused = true;
            }
        }

        if (Input.GetKeyDown(KeyBindings.keys["Journal"]))
        {
            if (journalPanel.activeInHierarchy)
            {
                journalPanel.SetActive(false);
                Camera_Control.paused = false;
            }
            else
            {
                journalPanel.SetActive(true);
                Camera_Control.paused = true;
            }
        }
    }
示例#18
0
 void Awake()
 {
     if(_instance == null)
     {
         //If I am the first instance, make me the Singleton
         _instance = this;
         //DontDestroyOnLoad(this);
     }
     else
     {
         //If a Singleton already exists and you find
         //another reference in scene, destroy it!
         if(this != _instance)
             Destroy(this.gameObject);
     }
 }
示例#19
0
 // Update is called once per frame
 void Update()
 {
     if (Input_Manager.R3Button())
     {
         if (col.height > 1)
         {
             col.height -= 0.1f;
         }
     }
     else
     {
         if (col.height < 2)
         {
             col.height += 0.1f;
         }
     }
 }
示例#20
0
 // Start is called before the first frame update
 void Start()
 {
     fired                = false;
     ship                 = Instantiate((GameObject)Resources.Load("Prefabs/ship"), new Vector3(0, 0, 0), Quaternion.identity);
     shipScript           = ship.GetComponent <Ship>();
     input                = this.GetComponent <Input_Manager>();
     gui                  = this.GetComponent <GUI_Manager>();
     gui.ShipLives        = 3;
     asteroidM            = this.GetComponent <Asteroid_Manager>();
     bManager             = this.GetComponent <Bullet_Manager>();
     sceneChange          = gameObject.GetComponent <Scene_Changer>();
     screenShake          = Camera.main.GetComponent <ShakeBehavior>();
     isCoroutineExecuting = false;
     AudioSource[] audioSources = GetComponents <AudioSource>();
     source = audioSources[0];
     laser  = audioSources[0].clip;
     crash  = audioSources[1].clip;
 }
    public override void OnInspectorGUI()
    {
        if (Input_Manager.Exists())
        {
            if (GUILayout.Button("Add Key"))
            {
                Input_Manager.instance.keysList.Add(new InputKeysValues());
            }

            if (GUILayout.Button("Remove Key"))
            {
                if (Input_Manager.instance.keysList.Count != 0)
                {
                    Input_Manager.instance.keysList.RemoveAt(Input_Manager.instance.keysList.Count - 1);
                }
            }
            DrawDefaultInspector();
        }
    }
示例#22
0
    public void act()
    {
        if (inputManager == null)
        {
            inputManager = Input_Manager.Instance();
        }
        if (wheaterManager == null)
        {
            wheaterManager = GameObject.FindObjectOfType <WeatherManager>();
        }

        if (wheaterManager.currentWeather != wheaterManager.weathers[0])
        {
            giveLove();
        }
        else
        {
            input(); //Hará la selección del objeto según el clima
        }
    }
示例#23
0
    private void checkMove()
    {
        if (Input_Manager.L3Button())
        {
            speed = 6f;
        }
        else if (Input_Manager.MainHorizontal() <= 0.1f && Input_Manager.MainVertical() <= 0.1f)
        {
            speed = 3f;
        }


        float J_DeltaX = Input_Manager.MainHorizontal() * speed;
        float J_DeltaZ = Input_Manager.MainVertical() * speed;

        Vector3 movement = new Vector3(J_DeltaX, 0, J_DeltaZ);

        movement = Vector3.ClampMagnitude(movement, speed);

        movement.y = gravity;
        movement  *= Time.deltaTime;
        movement   = transform.TransformDirection(movement);
        _charCont.Move(movement);
    }
示例#24
0
    // Update is called once per frame
    void Update()
    {
        if (!transform.parent.CompareTag("Player"))
        {
            return;
        }
        Vector2      pos = _Input.pos;
        RaycastHit2D hit = _Input.hit_Tile;


        if (Btn1)
        {
            if (Input_Manager.Highlighted != null)
            {
                Input_Manager.Highlighted();
                Input_Manager.Highlighted = null;
            }
            Cursor_Manager.m_Cursor_Manager.SetCursor(UI_MANAGER.m_UI_MANAGER.Cursors[0]);



            if (hit.transform != null && hit.transform.tag == "Tile")
            {
                Tile _Tile = hit.transform.GetComponent <Tile>();

                if (Mathf.Abs(_Tile.X - Unit.x) + Mathf.Abs(_Tile.Y - Unit.y) <= Weapon.Range)
                {
                    for (int x = _Tile.X - 1; x <= _Tile.X + 1; x++)
                    {
                        if (x < 0 || x >= Tile_Manager.m_Tile_Manager.X)
                        {
                            continue;
                        }
                        for (int y = _Tile.Y - 1; y <= _Tile.Y + 1; y++)
                        {
                            if (y < 0 || y >= Tile_Manager.m_Tile_Manager.Y)
                            {
                                continue;
                            }
                            if (x != _Tile.X && y != _Tile.Y)
                            {
                                continue;
                            }

                            Tile N_Tile = Tile_Manager.m_Tile_Manager.MY_Tile[x][y];

                            N_Tile.HighLight(1);
                        }
                    }
                }
            }
        }
        if (Input.GetMouseButtonDown(0))
        {
            if (Btn1)
            {
                if (hit.transform != null && hit.transform.tag == "Tile")
                {
                    Tile _Tile = hit.transform.GetComponent <Tile>();

                    if (Mathf.Abs(_Tile.X - Unit.x) + Mathf.Abs(_Tile.Y - Unit.y) <= Weapon.Range)
                    {
                        for (int x = _Tile.X - 1; x <= _Tile.X + 1; x++)
                        {
                            for (int y = _Tile.Y - 1; y <= _Tile.Y + 1; y++)
                            {
                                Weapon.HeadShot_Bonus = 0;
                                if (x < 0 || x >= _Tile._Tile.X || y < 0 || y >= _Tile._Tile.Y)
                                {
                                    continue;
                                }
                                if (x != _Tile.X && y != _Tile.Y)
                                {
                                    continue;
                                }

                                _Tile._Tile.MY_Tile[x][y].DownGrade();

                                if (_Tile._Tile.MY_Tile[x][y].transform.childCount > 0)
                                {
                                    if (_Tile._Tile.MY_Tile[x][y].transform.Find("Enemy(Clone)") != null)
                                    {
                                        Unit_Manager _Unit = _Tile._Tile.MY_Tile[x][y].transform.Find("Enemy(Clone)").GetComponent <Unit_Manager>();
                                        if (_Unit != null)
                                        {
                                            if (x == _Tile.X && y == _Tile.Y)
                                            {
                                                Weapon.HeadShot_Bonus = 100;
                                            }

                                            _Unit.Hit(Weapon);
                                        }
                                    }
                                    else if (_Tile._Tile.MY_Tile[x][y].transform.Find("Player(Clone)") != null)
                                    {
                                        Unit_Manager _Unit = _Tile._Tile.MY_Tile[x][y].transform.Find("Player(Clone)").GetComponent <Unit_Manager>();
                                        if (_Unit != null)
                                        {
                                            if (x == _Tile.X && y == _Tile.Y)
                                            {
                                                Weapon.HeadShot_Bonus = 100;
                                            }

                                            _Unit.Hit(Weapon);
                                        }
                                    }
                                }
                            }
                        }

                        Unit.Tile_InSighted = null;
                        Unit.View.InView();

                        Unit.Now_Action_Point -= 3;
                        Unit.DrawActionPoint();

                        Btn1   = false;
                        Action = false;
                        count--;

                        Cursor_Manager.m_Cursor_Manager.SetCursor(UI_MANAGER.m_UI_MANAGER.Cursors[1]);

                        if (count <= 0)
                        {
                            Unit.Items.Remove(this);
                            Unit.Select();
                            Destroy(gameObject);
                        }
                    }
                }
            }
        }
    }
示例#25
0
 void Awake()
 {
     im = GameObject.Find("GameManager").GetComponent <Input_Manager> ();
 }
示例#26
0
 void Awake()
 {
     im = GameObject.Find("GameManager").GetComponent <Input_Manager> ();
     Cursor.lockState = CursorLockMode.Confined;
     Cursor.lockState = CursorLockMode.Locked;
 }
示例#27
0
 // Update is called once per frame
 void Update()
 {
     //Get Input
     moveVertical   = Input_Manager.GetAxis("Move Vertical " + (playerNum + 1));
     moveHorizontal = Input_Manager.GetAxis("Move Horizontal " + (playerNum + 1));
     lookVertical   = Input_Manager.GetAxis("Look Vertical " + (playerNum + 1));
     lookHorizontal = Input_Manager.GetAxis("Look Horizontal " + (playerNum + 1));
     if (Input_Manager.GetAxisRaw("Move Vertical " + (playerNum + 1)) > 0 && previousMoveVertical == 0f)
     {
         if (Time.frameCount - lastTapFrame < 20)
         {
             RollForward();
         }
         else
         {
             lastTapFrame = Time.frameCount;
         }
     }
     previousMoveVertical = Input_Manager.GetAxisRaw("Move Vertical " + (playerNum + 1));
     if (Input.GetButton("Change Weapon " + (playerNum + 1)))
     {
         ChooseAttack(moveHorizontal, moveVertical);
     }
     if (Input.GetKey(KeyCode.LeftShift))
     {
         runMultiplier = 2f;
     }
     else
     {
         runMultiplier = 1f;
     }
     if (Input.GetKeyDown("k"))
     {
         if (lockedToEnemy)
         {
             lockedToEnemy = false;
             lockedEnemy   = null;
             ResetCam();
         }
         else if (FindNearestEnemy(out lockedEnemy))
         {
             mainCamera.transform.LookAt(lockedEnemy.transform);
             lockedToEnemy = true;
         }
     }
     //is input greater than 0
     else if (!rolling)
     {
         if (CheckGrounded() && Vector2.SqrMagnitude(new Vector2(moveHorizontal, moveVertical)) > 0.1f)
         {
             //Moves the player using velocities
             Move(moveHorizontal, moveVertical);
         }
     }
     if (Input.GetButtonDown("Jump " + (playerNum + 1)) && CheckGrounded())
     {
         Jump();
     }
     Attack();
     CameraFollow();
     AnimateMovement();
 }
示例#28
0
 protected void Start()
 {
     _Input = Camera.main.GetComponent <Input_Manager>();
 }
示例#29
0
 // Use this for initialization
 void Start()
 {
     m_InputManager = this;
     layerMask      = ~layerMask;
 }
示例#30
0
 void Awake()
 {
     anim = GetComponent <Animator> ();
     im   = GameObject.Find("GameManager").GetComponent <Input_Manager> ();
 }
示例#31
0
 void Awake()
 {
     im    = GameObject.Find("GameManager").GetComponent <Input_Manager>();
     bf_rt = button_frame.GetComponent <RectTransform>();
 }