Пример #1
0
 void Start()
 {
     p_i = gameObject.GetComponentInParent <Player_Input>();
     pb  = gameObject.GetComponent <ProblemBattery_Script>();
     pp  = gameObject.GetComponent <ProblemPower_Script>();
     pe  = gameObject.GetComponent <ProblemEngine_Script>();
 }
    private void Awake()
    {
        //Find the PlayerInput component
        playerInput = GameObject.Find("Main Camera").GetComponent <Player_Input>();

        //Subscription here
        playerInput.OnInventoryPress += InventoryCheck;
    }
Пример #3
0
 public PlayerAnimations(Animator animator, Transform player)
 {
     playerInput             = player.GetComponent <Player_Input>();
     this.animator           = animator;
     playerInput.OnJumpUp   += OnJumpInputUp;
     playerInput.OnJumpDown += OnJumpInputDown;
     playerInput.OnAttack   += OnAttack;
 }
Пример #4
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.name == "Controller (left)" || other.name == "Controller (right)")
     {
         goController = other.gameObject.GetComponent <Player_Input>();
         bCanGrab     = true;
     }
 }
Пример #5
0
 private void OnTriggerExit(Collider other)
 {
     if (other.name == "Controller (left)" || other.name == "Controller (right)")
     {
         goController = null;
         bCanGrab     = false;
     }
 }
Пример #6
0
 private void Start()
 {
     playerInput = GetComponent<Player_Input>();
     m_Player = GetComponent<CharacterController>();
     originalFOV = Camera.main.fieldOfView;
     SpawnWeapon();
     InitWeapon();
 }
Пример #7
0
 private void Start()
 {
     weaponController = GetComponent <Weapon_Controller>();
     cameraController = GetComponent <Camera_Controller>();
     playerInput      = GetComponent <Player_Input>();
     m_Player         = GetComponent <CharacterController>();
     m_Anim           = weaponController.ActiveWeaponAnimator;
 }
Пример #8
0
    void Start()
    {
        pi = gameObject.GetComponent <Player_Input>();

        bat = gameObject.GetComponentInChildren <ProblemBattery_Script>();
        pow = gameObject.GetComponentInChildren <ProblemPower_Script>();
        eng = gameObject.GetComponentInChildren <ProblemEngine_Script>();
    }
Пример #9
0
 void Start()
 {
     fpsCam            = transform.parent.GetComponent <Camera>();
     playerInput       = transform.root.GetComponent <Player_Input>();
     playerController  = transform.root.GetComponent <Player_Controller>();
     m_Player          = transform.root.GetComponent <CharacterController>();
     m_Anim            = GetComponent <Animator>();
     currentAmmoInClip = weaponStats.magazineSize;
     totalAmmo         = weaponStats.ammoCarryingCapacity - weaponStats.magazineSize;
 }
Пример #10
0
 void Awake()
 {
     player = GameObject.FindGameObjectWithTag(Tags.player);
     playerViewport = GameObject.FindGameObjectWithTag(Tags.playerViewport).GetComponent<Camera>();
     playerHealth = player.GetComponent<Player_Health>();
     playerInput = player.GetComponent<Player_Input>();
     fader = player.GetComponentInChildren<Camera_UI>();
     spawnPosition = player.transform.position;
     spawnRotation = player.transform.rotation;
 }
Пример #11
0
    private void AttachPlayers()
    {
        Player_Input inputScript = GetComponent <Player_Input>();

        inputScript.Player1    = playerOne;
        inputScript.Player2    = playerTwo;
        inputScript.Player1_rb = playerOne.GetComponent <Rigidbody2D>();
        inputScript.Player2_rb = playerTwo.GetComponent <Rigidbody2D>();

        playersInstantiated = true;
    }
Пример #12
0
 void Awake()
 {
     player = GameObject.FindGameObjectWithTag(Tags.player);
     if(player != null)
     {
         playerViewport = player.GetComponentInChildren<Camera>();
         viewportBlur = player.GetComponentInChildren<Blur>();
         playerInput = player.GetComponent<Player_Input>();
     }
     contextMessage.text = "";
     
     if (SceneManager.GetActiveScene().buildIndex == 2)
         levelController = GameObject.FindGameObjectWithTag(Tags.levelController).GetComponent<MainLevelController>();
 }
Пример #13
0
    void Awake()
    {
        playerHead = GameObject.FindGameObjectWithTag(Tags.playerHead);
        playerViewport = GameObject.FindGameObjectWithTag(Tags.playerViewport);
        playerInput = GameObject.FindGameObjectWithTag(Tags.player).GetComponent<Player_Input>();
        rigid = GetComponent<Rigidbody>();
        col = GetComponent<CapsuleCollider>();

        ForwardSpeed = maximumNormalSpeed;
        StrafeSpeed = maximumNormalSpeed * 0.8f;
        BackwardsSped = maximumNormalSpeed * 0.8f;
        
        characterTargetRotation = transform.localRotation;
        cameraTargetRotation = playerViewport.transform.localRotation;
    }
Пример #14
0
    private void Awake()
    {
        Instance = this;

        player_Animation = GetComponent <Player_Animation>();
        player_Stats     = GetComponent <Player_Stats>();
        player_Collision = GetComponent <Player_Collision>();
        player_Actions   = GetComponent <Player_Actions>();
        player_Input     = GetComponent <Player_Input>();
        player_Equipment = GetComponent <Player_Equipment>();
        player_Quest     = GetComponent <Player_Quest>();
        player_Event     = GetComponent <Player_Events>();

        animator = GetComponent <Animator>();
        rb2D     = GetComponent <Rigidbody2D>();
    }
Пример #15
0
    private void Start()
    {
        GameManager.instance.drone = gameObject;
        transform.position         = GameManager.instance.dronePosition;
        target      = GameManager.instance.player.transform;
        playerInput = GameManager.instance.player.GetComponent <Player_Input>();
        seeker      = GetComponent <Seeker>();
        rb          = GetComponent <Rigidbody2D>();

        if (target == null)
        {
            Debug.Log("No Player found");
            return;
        }

        seeker.StartPath(transform.position, target.position - offset, OnPathComplete);
        StartCoroutine(UpdatePath());
    }
Пример #16
0
 void Awake()
 {
     prefeb = GameObject.Find("prefeb");
     prefeb.SetActive(false);
     ao            = new AsyncObject(UID, BUFFER_SIZE);
     pi            = new Player_Input();
     psl           = new Player_State_List(2);
     gameObjects   = new GameObject[psl.userCount];
     isInstantiate = new bool[psl.userCount];
     for (int i = 0; i < psl.userCount; i++)
     {
         psl.states[i]    = new Player_State(i);
         isInstantiate[i] = false;
     }
     positionThread = new Thread(Positioning);
     positionThread.IsBackground = true;
     Console.WriteLine("Starting client...");
     positionThread.Start();
 }
Пример #17
0
    private void findLookDirection()
    {
        Player_Input input = gameObject.transform.parent.GetComponentInChildren <Player_Input>();

        if (input.quad1)
        {
            gameObject.transform.parent.rotation = Quaternion.Euler(0, 180, 0);
            if (animationManager.animationDataObject != faceAwayFromPlayer)
            {
                animationManager.changeAnimation(faceAwayFromPlayer);
            }
        }
        else if (input.quad2)
        {
            gameObject.transform.parent.rotation = Quaternion.Euler(0, 0, 0);
            if (animationManager.animationDataObject != faceAwayFromPlayer)
            {
                animationManager.changeAnimation(faceAwayFromPlayer);
            }
        }
        else if (input.quad3)
        {
            gameObject.transform.parent.rotation = Quaternion.Euler(0, 180, 0);
            if (animationManager.animationDataObject != faceToPlayer)
            {
                animationManager.changeAnimation(faceToPlayer);
            }
        }
        else if (input.quad4)
        {
            gameObject.transform.parent.rotation = Quaternion.Euler(0, 0, 0);
            if (animationManager.animationDataObject != faceToPlayer)
            {
                animationManager.changeAnimation(faceToPlayer);
            }
        }
        else
        {
        }
    }
Пример #18
0
    void getBody(int i, int BODY_SIZE)
    {
        ao[i].WorkingSocket.Receive(ao[i].Buffer, 0, BODY_SIZE, SocketFlags.None);

        string jsonData = System.Text.Encoding.UTF8.GetString(ao[i].Buffer);

        if (jsonData == "connection failed")    // 연결 종료
        {
            psl.isConnected[i] = 0;
            ao[i].ClearBuffer();
            ao[i].WorkingSocket.Close();
            gameObjects[i].SetActive(false);
            Console.WriteLine("[" + i + "] 접속 종료");
            return;
        }
        else    // 키 입력 데이터 받음.
        {
            Player_Input pi = Converter.JsonToOject <Player_Input>(jsonData);
            pil.list[i] = pi;
        }

        // 데이터를 받은 후엔 다시 버퍼를 비워주고 같은 방법으로 수신을 대기한다.
        ao[i].ClearBuffer();
    }
Пример #19
0
 private void Start()
 {
     playerInput = GetComponent<Player_Input>();
     playerCam = Camera.main;
     Cursor.lockState = CursorLockMode.Locked;
 }
 void Start()
 {
     instance = this;
 }
Пример #21
0
 private void Awake()
 {
     player       = GetComponent <Player>();
     player_Input = player.player_Input;
 }
Пример #22
0
 void Start()
 {
     ss     = GameObject.FindObjectOfType <Spawn_Script>();
     player = GameObject.FindObjectOfType <Player_Input>();
 }
Пример #23
0
	void Awake()
    {
        player = GameObject.FindGameObjectWithTag(Tags.player);
        playerInput = player.GetComponent<Player_Input>();
        tutorialController = GameObject.Find("TutorialController").GetComponent<TutorialController>();
    }
 /**
  * 入力の読み込み
  */
 public void setInput(Player_Input input)
 {
     this.input = input;
 }
Пример #25
0
 // Start is called before the first frame update
 void Start()
 {
     player            = GetComponent <Player_Input>();
     currWeapon        = weaponList[0];
     player.currWeapon = currWeapon;
 }
Пример #26
0
 // Start is called before the first frame update
 void Start()
 {
     charactercontroller = GetComponent <CharacterController>();
     playerstat          = GetComponent <Player_Stat>();
     playerin            = GetComponent <Player_Input>();
 }