예제 #1
0
    void Awake()
    {
        Debug.Assert(targetRef != null);

        input = GetComponent <IPlayerInput>();
        Debug.Assert(input != null);
    }
예제 #2
0
    public void Init(PlayerMovement ship)
    {
        var uiController = SpawnUI();

        PlayerInput = CreatePlayerInput();
        PlayerInput.Init(uiController);
        Clear(ship);
    }
예제 #3
0
 private void Start()
 {
     if (!gameObject.CompareTag(Tags.GameManager))
     {
         Debug.LogError("GameManager: has to be tagged as GameManager.");
     }
     _input = GameObject.FindWithTag(Tags.Input).GetComponent <IPlayerInput>();
 }
예제 #4
0
        public void AttachHero(IHero hero, IPlayerInput playerInput)
        {
            Hero = hero;

            var heroController = (HeroController)hero;

            heroController.AttachPlayerInput(playerInput);
        }
        public TetrisBoard(IPieceGenerator generator, IPlayerInput playerInput)
        {
            PlayerInput = playerInput;
            PressTime = Enum.GetValues(typeof(InputButton)).OfType<InputButton>().ToDictionary(k => k, k => TimeSpan.Zero);

            State = TetrisGameState.NewGameState(generator);
            UpdateLevel();
        }
예제 #6
0
 public Board(IPlayerInput playerInput)
 {
     _playerInput = playerInput;
     Hits         = 0;
     Misses       = 0;
     Ships        = new List <Ship>();
     Coordinates  = GenerateBoardCells();
 }
 private void Awake()
 {
     _characterController = GetComponent <CharacterController>();
     PlayerInput          = new PlayerInput();
     _playerMoviment      = new PlayerMoviment(this);
     _playerRotator       = new PlayerRotator(this);
     PlayerInput.OnMoveModeTogglePressed += HandleMoveModeTogglePressed;
 }
예제 #8
0
 public void Init(IPlayerInput input)
 {
     Input = input as SoldierPlayerInput;
     if (Input == null)
     {
         throw new ArgumentException("Player Input was not of type SoldierPlayerInput");
     }
 }
예제 #9
0
 public PlayerRotation(float desiredRotationSpeed, Transform playerTransform, Camera mainCam, IPlayerInput playerInput, Rigidbody playerRigidbody)
 {
     this.desiredRotationSpeed = desiredRotationSpeed;
     this.playerTransform      = playerTransform;
     this.mainCam         = mainCam;
     this.playerInput     = playerInput;
     this.playerRigidbody = playerRigidbody;
 }
예제 #10
0
    //private AudioManager _audioManager;
    //public FloatVal _health;

    //[SerializeField] private Item _prefabs;

    private void Awake()
    {
        _audioSource         = GetComponent <AudioSource>();
        _animator            = GetComponent <Animator>();
        _playerInput         = GetComponent <IPlayerInput>();
        _playerInput.OnFire += Fire;
        //_audioManager = new AudioManager();
    }
예제 #11
0
 internal PlayerController(
     IPlayerInput input, GameObject camera, IManagedPerson managedPerson)
 {
     _managedPerson = managedPerson;
     _input         = input;
     _camera        = camera.GetComponent <Camera>();
     _pathMarkPool  = new GameObjectsPool <PathMarksFabric>(
         new PathMarksFabric(), _marksPoolSize);
 }
예제 #12
0
        void Awake()
        {
            _acitionView        = FindObjectOfType <ActionView>() as IActionView;
            _inputManagerPlayer = new PlayerInputManager();
            _human = new Player(_inputManagerPlayer);

            InitInputManagers();
            InitGameManager();
        }
예제 #13
0
        public void Process(IPlayerInput inputCommand)
        {
            var o = inputCommand as PlayerNameInput;

            if (o != null)
            {
                state.Players[playerId].Name = o.Name;
            }
        }
예제 #14
0
        void InitializePlayer(InteractiveStorage interactiveStorage,
                              GameObjectFabric fabric, IPlayerInput playerInput)
        {
            var        playerObject = fabric.GetPlayer();
            PlayerView playerView   = playerObject.GetComponent <PlayerView>();

            playerView.SetInput(playerInput);
            interactiveStorage.Add(playerView);
        }
예제 #15
0
 public Game(ILevelFactory levelFactory, IGameSettingLoader gameSettingLoader, IDisplay display,
             IMazeFactory mazeFactory, IPlayerInput playerInput)
 {
     _levelFactory      = levelFactory;
     _gameSettingLoader = gameSettingLoader;
     _display           = display;
     _mazeFactory       = mazeFactory;
     _playerInput       = playerInput;
 }
예제 #16
0
    public void Awake()
    {
        var m = GetComponent <ICharacterSheet>().GetStat(StatType.MoveSpeed);

        this.moveSpeed      = (m == null ? 0f : m.Value);
        characterController = GetComponent <CharacterController>();
        animator            = GetComponent <AnimationSystem>();
        playerInput         = GetComponent <IPlayerInput>();
    }
예제 #17
0
 private void Awake()
 {
     gameObject.name      = "Player";
     _audioSource         = GetComponent <AudioSource>();
     _animator            = GetComponent <Animator>();
     _playerInput         = GetComponent <IPlayerInput>();
     _playerInput.OnFire += Fire;
     _audioManager        = new AudioManager();
 }
예제 #18
0
 public BaseCharacter(Texture2D sprite, MainGame.Tag tag, Vector2 spawnPosition, string name, MainGame game, IPlayerInput input)
     : base(sprite, tag, spawnPosition, name, game)
 {
     baseRectangle = new Rectangle(0, 0, 50, 50);
     velocity = Vector2.Zero;
     this.SpawnPosition = spawnPosition;
     this.input = input;
     Reset();
 }
예제 #19
0
 protected void Awake()
 {
     //Playerからの入力クラスを取得
     PlayerInput = this.FindObjectOfInterface <IPlayerInput>();
     PlayerInput.Accel.Subscribe(_ =>
     {
         //transform.rotation *= Quaternion.Euler()
     });
 }
예제 #20
0
 // Start is called before the first frame update
 private void Start()
 {
     playerInput = GetComponent <IPlayerInput>();
     Rb2D        = GetComponent <Rigidbody2D>();
     playerInput.MoveDirectionReactiveProperty
     .Skip(1)
     .Subscribe(x => Move(x))
     .AddTo(gameObject);
 }
예제 #21
0
        public void AttachPlayerInput(IPlayerInput playerInput)
        {
            UnsubscribeInputListeners();

            _playerInput = playerInput;

            _playerInput.OnMoveEvent      += OnMove;
            _playerInput.OnBombPlantEvent += OnBombPlant;
        }
예제 #22
0
        void Awake()
        {
            _animator = GetComponent <Animator>();

            _input       = GameObject.FindWithTag(Tags.Input).GetComponent <IPlayerInput>();
            _gameManeger = GameObject.FindWithTag(Tags.GameManager).GetComponent <GameManager>();

            _gameManeger.GameFinishedEvent += () => _animator.SetBool(_isShootingParameterName, false);
        }
예제 #23
0
 public PlayerMovement(Transform playerTransform, Camera mainCam, IPlayerInput playerInput, float speed, Rigidbody playerRigidbody, float jumpPower, Transform groundChecker)
 {
     this.playerTransform = playerTransform;
     this.mainCam         = mainCam;
     this.playerInput     = playerInput;
     this.speed           = speed;
     this.playerRigidbody = playerRigidbody;
     this.jumpPower       = jumpPower;
     this.groundChecker   = groundChecker;
 }
예제 #24
0
 public PlayerSprite(IPlayerInput activeInput, Color spriteColor, int playerNumber,
                     int animationFrameCount, int animationFramesPerSecond, string animationStartName, float scale)
     : base(animationFrameCount, animationFramesPerSecond, animationStartName, scale)
 {
     SpriteColor   = spriteColor;
     ActiveInput   = activeInput;
     PlayerNumber  = playerNumber;
     Position      = Settings.Instance.ScreenCenter;
     base.Rotation = 0.0f;
 }
예제 #25
0
 public PlayerMovement(Transform playerTransform, Camera mainCam, IPlayerInput playerInput, float speed, CharacterController playerController, float jumpPower, Transform groundChecker)
 {
     this.playerTransform  = playerTransform;
     this.mainCam          = mainCam;
     this.playerInput      = playerInput;
     this.speed            = speed;
     this.playerController = playerController;
     this.jumpPower        = jumpPower;
     this.groundChecker    = groundChecker;
 }
예제 #26
0
 private void Awake()
 {
     _input     = new MobileInput();
     _mover     = new MoverWithVelocity(this, moveSpeed);
     _animation = new CharacterAnimation(GetComponent <Animator>());
     _flip      = new FlipWithTransform(this);
     _onGround  = GetComponent <IOnGround>();
     _jump      = new JumpMulti(GetComponent <Rigidbody2D>(), _onGround);
     _health    = GetComponent <IHealth>();
 }
예제 #27
0
 public PlayerMovementState(IPlayerEntity playerController, IStateMachine stateMachine) : base(stateMachine)
 {
     _playerController = playerController;
     _rigidBody        = playerController.RigidBody;
     _animator         = playerController.Animator;
     _groundCollider   = playerController.GroundCollider;
     _coyoteTimeBuffer = playerController.CoyoteTimeBuffer;
     _input            = playerController.Input;
     _playerSettings   = playerController.PlayerControllerSettings;
 }
예제 #28
0
        public PlayerController(ICameraRay cameraRay, IPlayerInput playerInput)
        {
            _playerMoveSystem = new PlayerMoveSystem();
            _playerLookSystem = new PlayerLookSystem();

            _weaponSystem   = new PlayerWeaponSystem();
            _activitySystem = new PlayerActivitySystem(_weaponSystem);

            _cameraRay   = cameraRay;
            _playerInput = playerInput;
        }
예제 #29
0
        protected override void Awake()
        {
            base.Awake();

            PlayerInput = new PlayerInput();

            Health = new Health(3);
            Bank   = new Bank();

            TargetPos = transform.position;
        }
예제 #30
0
	//Skills

	//Itens

	public Player(string name, IPlayerInput input)
	{
		Name = name;

		Stats = new PlayerStats ();
		Stats.InitialStats (Name);

		Portrait = Resources.Load<Sprite> ("Playable Characters/" + name);

		Input = input;
	}
예제 #31
0
    //Skills

    //Itens

    public Player(string name, IPlayerInput input)
    {
        Name = name;

        Stats = new PlayerStats();
        Stats.InitialStats(Name);

        Portrait = Resources.Load <Sprite> ("Playable Characters/" + name);

        Input = input;
    }
예제 #32
0
        //bool _isAttack = false;



        private void Awake()
        {
            _input       = new PcInput();    //!!!SpawnerMove değiştirmeyi unutma!!!
            _mover       = new Mover(this, movespeed);
            _animation   = new CharacterAnimation(GetComponent <Animator>());
            _flip        = new FlipWithTranform(this);
            _jump        = new Jump(GetComponent <Rigidbody2D>());
            _onGround    = GetComponent <IOnground>();
            _health      = GetComponent <IHealth>();
            _audioSource = GetComponent <AudioSource>();
        }
예제 #33
0
        protected override void PreSpawnPlayer(Entity playerEntity)
        {
            var controller = playerEntity.Get <SoldierController>();

            if (controller != null)
            {
                Player = currentSoldier = controller;
                IPlayerInput input = playerEntity.Get <SoldierPlayerInput>();
                Player.Init(input);
            }
        }
예제 #34
0
        internal Game1(IPlayerInput playerInput, IWorldLoader worldLoader)
        {
            if (playerInput == null)
                throw new ArgumentNullException("playerInput");
            if (worldLoader == null)
                throw new ArgumentNullException("worldLoader");
            this.PlayerInput = playerInput;
            this.PlayerInput.GameInput = new GameInput(this);
            this._worldLoader = worldLoader;

            this._gdm = new GraphicsDeviceManager(this)
                            {
                                PreferredBackBufferWidth = RoomSizeWidth * ZoomWhilstWindowed,
                                PreferredBackBufferHeight = RoomSizeHeight * ZoomWhilstWindowed
                            };
            this.Content.RootDirectory = "Content";
            //this.TargetElapsedTime = new TimeSpan(this.TargetElapsedTime.Ticks * 4);
            this._lives = 2;
            this._score = 0;
            this._displayedScore = 0;
            this.SoundPlayer = new NullSoundPlayer();
        }
예제 #35
0
	public int SimulateUpDownOnGUI(int arrayIndex, IPlayerInput input, string direction, 
		int numberButtons, int linhas, int i)
	{
		if (direction == "Vertical")
		{
			if (input.Axis.y < 0 && Unlockers[arrayIndex])
			{
				int lastIndex = i;
				i++;

				if (i == numberButtons)
				{
					i = lastIndex;
				}

				Unlockers[arrayIndex] = false;
			}

			if (input.Axis.y > 0 && Unlockers[arrayIndex])
			{
				int lastIndex = i;
				i--;

				if (i < 0)
				{
					i = lastIndex;
				}

				Unlockers[arrayIndex] = false;
			}

			if (input.Axis.y == 0 && !Unlockers[arrayIndex])
			{
				Unlockers[arrayIndex] = true;
			}
		}

		if (direction == "Horizontal")
		{
			if (input.Axis.x < 0 && Unlockers[arrayIndex])
			{
				int lastIndex = i;
				i--;

				if (i < 0)
				{
					i = lastIndex;

				}
				Debug.Log (i);
				Unlockers[arrayIndex] = false;
			}

			if (input.Axis.x > 0 && Unlockers[arrayIndex])
			{
				int lastIndex = i;
				i++;

				if (i == numberButtons)
				{
					i = lastIndex;

				}
				Debug.Log (i);
				Unlockers[arrayIndex] = false;
			}

			if (input.Axis.x == 0 && !Unlockers[arrayIndex])
			{
				Unlockers[arrayIndex] = true;
			}
		}

		if (direction == "Both")
		{
			int buttonsPorLinha = numberButtons / linhas;

			if (input.Axis.x < 0 && Unlockers[arrayIndex])
			{
				int lastIndex = i;
				i--;

				if (i < 0)
				{
					i = lastIndex;
				}

				Unlockers[arrayIndex] = false;
			}

			if (input.Axis.x < 0 && Unlockers[arrayIndex])
			{
				i++;

				if (i == numberButtons)
				{
					i = numberButtons - 1;
				}

				Unlockers[arrayIndex] = false;
			}

			if (input.Axis.y > 0 && Unlockers[arrayIndex])
			{
				int lastIndex = i;
				i -= buttonsPorLinha;

				if (i < 0)
				{
					i = lastIndex;
				}

				Unlockers[arrayIndex] = false;
			}

			if (input.Axis.y < 0 && Unlockers[arrayIndex])
			{
				int lastIndex = i;
				i += buttonsPorLinha;
	
				if (i >= numberButtons)
				{
					i = lastIndex;
				}

				Unlockers[arrayIndex] = false;
			}

			if ((input.Axis.x == 0 && input.Axis.y == 0) && !Unlockers[arrayIndex])
			{
				Unlockers[arrayIndex] = true;
			}
		}

		return i;
    }
예제 #36
0
 public Runner(Vector2 position, string name, MainGame game, IPlayerInput input)
     : base(runnerSprite, MainGame.Tag.Runner, position, name, game, input)
 {
     this.PlayerInput = null;
     speed_Walk = 550;
 }
예제 #37
0
 public Bomber(Vector2 position, string name, MainGame game, IPlayerInput input)
     : base(bomberSprite, MainGame.Tag.Bomber, position, name, game, input)
 {
     baseColor = bomberColor;
     respawnTime = 0.85f;
 }
예제 #38
0
 // PLAYERINPUT:
 public static void Write(this NetBuffer netbuffer, IPlayerInput input)
 {
     netbuffer.Write(input.Position);
     if (input.PendingStatus != null)
     {
         netbuffer.Write(true);
         netbuffer.Write((ushort)input.PendingStatus);
     }
     else
     {
         netbuffer.Write(false);
     }
     if (input.PendingShot != null)
     {
         netbuffer.Write(true);
         netbuffer.Write((Vector2)input.PendingShot);
     }
     else
     {
         netbuffer.Write(false);
     }
 }
예제 #39
0
	public void ButtonControl(PointerEventData pointer, IPlayerInput input, Button[] buttons, int i)
	{
		ExecuteEvents.Execute(buttons[i].gameObject, pointer, ExecuteEvents.pointerEnterHandler);

		foreach (Button b in buttons) 
		{
			if (b != buttons [i]) 
			{
				ExecuteEvents.Execute(b.gameObject, pointer, ExecuteEvents.pointerExitHandler);
			}
		}

		if (input.Submit)
		{
			ExecuteEvents.Execute(buttons[i].gameObject, pointer, ExecuteEvents.submitHandler);
		}
	}