Пример #1
0
 private void KeyInput()
 {
     if (Input.anyKeyDown)
     {
         activeInput = true;
     }
     if (activeInput && checkSideCollision == false)
     {
         if (Input.GetKey(KeyCode.A))
         {
             directInput = DirectionInput.Left;
             activeInput = false;
         }
         else
         if (Input.GetKey(KeyCode.D))
         {
             directInput = DirectionInput.Right;
             activeInput = false;
         }
     }
     else
     {
         directInput = DirectionInput.Null;
     }
 }
Пример #2
0
    private void KeyInput()
    {
        if (Input.anyKeyDown)
        {
            activeInput = true;
        }

        if (activeInput)
        {
            switch (Event.current.keyCode)
            {
            case KeyCode.A:
                directionInput = DirectionInput.LEFT;
                break;

            case KeyCode.W:
                directionInput = DirectionInput.UP;
                break;

            case KeyCode.S:
                directionInput = DirectionInput.DOWN;
                break;

            case KeyCode.D:
                directionInput = DirectionInput.RIGHT;
                break;
            }
            activeInput = false;
        }
        else
        {
            directionInput = DirectionInput.NULL;
        }
    }
Пример #3
0
        public async Task <string> GetWeatherDataAsync(DirectionInput directionInput)
        {
            var halfwayPoint = new Coordinate
            {
                Latitude  = (directionInput.FromCoordinate.Latitude + directionInput.ToCoordinate.Latitude) / 2,
                Longitude = (directionInput.FromCoordinate.Longitude + directionInput.ToCoordinate.Longitude) / 2,
            };

            _currentBearing = DegreeBearing(directionInput);
            List <StationDto> stationDtos = await GetStations();

            var nearestStation = stationDtos.OrderBy(x => DistanceToStation(x, halfwayPoint)).First(t => t.WindDirection != null && t.WindSpeed != null);
            var result         = string.Empty;
            var windDirection  = (Int32.Parse(nearestStation.WindDirection) + 180) % 360;

            if (DegreeDistance(windDirection, DegreesRelativeBearing(LEFT_ANGLE_TAIL_WIND)) <= 90 && DegreeDistance(windDirection, DegreesRelativeBearing(RIGHT_ANGLE_TAIL_WIND)) <= 90)
            {
                result = "Tail wind! :)";
            }
            else if (DegreeDistance(windDirection, DegreesRelativeBearing(RIGHT_ANGLE_HEAD_WIND)) <= 90 && DegreeDistance(windDirection, DegreesRelativeBearing(LEFT_ANGLE_HEAD_WIND)) <= 90)
            {
                result = "Head wind! ;(";
            }
            else
            {
                result = "Side wind!";
            }

            return(JsonConvert.SerializeObject(value: result));
        }
Пример #4
0
 private void TouchInput()
 {
     if (Input.GetMouseButtonDown(0))
     {
         currentPos  = Input.mousePosition;
         activeInput = true;
     }
     if (Input.GetMouseButton(0) && checkSideCollision == false)
     {
         if (activeInput)
         {
             if ((Input.mousePosition.x - currentPos.x) > 40)
             {
                 directInput = DirectionInput.Right;
                 activeInput = false;
             }
             else if ((Input.mousePosition.x - currentPos.x) < -40)
             {
                 directInput = DirectionInput.Left;
                 activeInput = false;
             }
         }
         else
         {
             directInput = DirectionInput.Null;
         }
     }
     if (Input.GetMouseButtonUp(0))
     {
         directInput = DirectionInput.Null;
     }
     currentPos = Input.mousePosition;
 }
Пример #5
0
 public DirectionInput GetDirectionInput()
 {
     if (m_DirectionInput == null)
     {
         m_DirectionInput = new DirectionInput(m_HorizontalAxisName, m_VerticalAxisName, m_DirectionThreshold);
     }
     return(m_DirectionInput);
 }
Пример #6
0
 public override void Initialize()
 {
     _health         = new Hitpoints(100);
     _speed          = 2f;
     _isFrozen       = false;
     _keyInput       = new KeyInput("Horizontal", "Vertical");
     _directionInput = new DirectionInput();
 }
Пример #7
0
        private static double DegreeBearing(DirectionInput directionInput)
        {
            var dLon = ToRad(directionInput.ToCoordinate.Longitude - directionInput.FromCoordinate.Longitude);
            var dPhi = Math.Log(Math.Tan(ToRad(directionInput.ToCoordinate.Latitude) / 2 + Math.PI / 4) / Math.Tan(ToRad(directionInput.FromCoordinate.Latitude) / 2 + Math.PI / 4));

            if (Math.Abs(dLon) > Math.PI)
            {
                dLon = dLon > 0 ? -(2 * Math.PI - dLon) : (2 * Math.PI + dLon);
            }
            return(ToBearing(Math.Atan2(dLon, dPhi)));
        }
Пример #8
0
 //Set inputs (by PlayerInput)
 public virtual void SetPlayerInput(PlayerInput a_PlayerInput)
 {
     m_PlayerInput = a_PlayerInput;
     if (a_PlayerInput.GetDirectionInput("Move") != null)
     {
         m_MovementInput = a_PlayerInput.GetDirectionInput("Move");
     }
     else
     {
         Debug.LogError("Move input not set up in character input");
     }
 }
Пример #9
0
    private void DirectionAngleInput()
    {
        if (Input.GetMouseButtonDown(0))
        {
            currentP    = Input.mousePosition;
            activeInput = true;
        }
        if (Input.GetMouseButton(0))
        {
            if (activeInput)
            {
                float disX = Input.mousePosition.x - currentP.x;
                float disY = Input.mousePosition.y - currentP.y;
                // x轴y轴 有一方向移动距离超过20就触发
                if (Mathf.Abs(disX) > 20 || Mathf.Abs(disY) > 20)
                {
                    // 触发时,y轴移动较多
                    if (Mathf.Abs(disY) >= Mathf.Abs(disX))
                    {
                        if (disY > 0)
                        {
                            directionInput = DirectionInput.UP;
                        }
                        else
                        {
                            directionInput = DirectionInput.DOWN;
                        }
                    }
                    else
                    {
                        // 触发时,x轴移动较多
                        if (disX > 0)
                        {
                            directionInput = DirectionInput.RIGHT;
                        }
                        else
                        {
                            directionInput = DirectionInput.LEFT;
                        }
                    }
                    activeInput = false;
                }
            }
        }

        if (Input.GetMouseButtonUp(0))
        {
            directionInput = DirectionInput.NULL;
            activeInput    = false;
        }
    }
Пример #10
0
    void KeyInput()
    {
        if (Input.anyKeyDown)
        {
            activeInput = true;
        }

        if (activeInput)
        {
            if (Input.GetKey(KeyCode.A))
            {
                directInput = DirectionInput.Left;
                activeInput = false;
            }
            else
            {
                if (Input.GetKey(KeyCode.D))
                {
                    directInput = DirectionInput.Right;
                    activeInput = false;
                }
                else
                {
                    if (Input.GetKey(KeyCode.W))
                    {
                        directInput = DirectionInput.Up;
                        activeInput = false;
                    }
                    else
                    {
                        if (Input.GetKey(KeyCode.S))
                        {
                            directInput = DirectionInput.Down;
                            activeInput = false;
                        }
                    }
                }
            }
        }
        else
        {
            directInput = DirectionInput.Null;
        }
    }
Пример #11
0
    //Key input method
    private void KeyInput()
    {
        if (ishited)        // 撞到物件時不可操作
        {
            return;
        }

        if (Input.anyKeyDown)
        {
            activeInput = true;
        }

        if (activeInput && checkSideCollision == false)
        {
            if (Input.GetKey(KeyCode.A) || Input.GetKey(KeyCode.LeftArrow))
            {
                directInput = DirectionInput.Left;
                activeInput = false;
            }
            else if (Input.GetKey(KeyCode.D) || Input.GetKey(KeyCode.RightArrow))
            {
                directInput = DirectionInput.Right;
                activeInput = false;
            }
            else if (Input.GetKey(KeyCode.W) || Input.GetKey(KeyCode.UpArrow))
            {
                directInput = DirectionInput.Up;
                activeInput = false;
            }
            else if (Input.GetKey(KeyCode.S) || Input.GetKey(KeyCode.DownArrow))
            {
                directInput = DirectionInput.Down;
                activeInput = false;
            }
        }
        else
        {
            directInput = DirectionInput.Null;
        }
    }
Пример #12
0
 private void TouchInput()
 {
     if (Input.GetMouseButtonDown(0))
     {
         currentP    = Input.mousePosition;
         activeInput = true;
     }
     if (Input.GetMouseButton(0))
     {
         if (activeInput)
         {
             if ((Input.mousePosition.x - currentP.x) > 40)
             {
                 directionInput = DirectionInput.RIGHT;
             }
             else if ((Input.mousePosition.x - currentP.x) < -40)
             {
                 directionInput = DirectionInput.LEFT;
             }
             else if ((Input.mousePosition.y - currentP.y) > 40)
             {
                 directionInput = DirectionInput.UP;
             }
             else if ((Input.mousePosition.y - currentP.y) < -40)
             {
                 directionInput = DirectionInput.DOWN;
             }
             activeInput = false;
         }
         else
         {
             directionInput = DirectionInput.NULL;
         }
         if (Input.GetMouseButtonUp(0))
         {
             directionInput = DirectionInput.NULL;
         }
         currentP = Input.mousePosition;
     }
 }
Пример #13
0
	//Key input method
	private void KeyInput()
	{
		if(Input.anyKeyDown)
		{
			activeInput = true;
		}
		
		if(activeInput && checkSideCollision == false)
		{
			if(Input.GetKey(KeyCode.A) || Input.GetKey(KeyCode.LeftArrow))
			{
				directInput = DirectionInput.Left;
				activeInput = false;
			}else
			
			if(Input.GetKey(KeyCode.D) || Input.GetKey(KeyCode.RightArrow))
			{
				directInput = DirectionInput.Right;
				activeInput = false;
			}else
			
			if(Input.GetKey(KeyCode.W) || Input.GetKey(KeyCode.UpArrow))
			{
				directInput = DirectionInput.Up;
				activeInput = false;
			}else
				
			if(Input.GetKey(KeyCode.S) || Input.GetKey(KeyCode.DownArrow))
			{
				directInput = DirectionInput.Down;
				activeInput = false;
			}
		}else{
			directInput = DirectionInput.Null;	
		}
		
		
	}
Пример #14
0
 public async Task <string> GetWind([FromBody] DirectionInput directionInput)
 {
     return(await _smhiService.GetWeatherDataAsync(directionInput));
 }
Пример #15
0
	//Touch input method
	private void TouchInput(){
		if(Input.GetMouseButtonDown(0)){
			currentPos = Input.mousePosition;	
			activeInput = true;
		}
		if(Input.GetMouseButton(0) && checkSideCollision == false){
			if(activeInput){
				if((Input.mousePosition.x - currentPos.x) > 40){
					directInput = DirectionInput.Right;
					activeInput = false;
				}else if((Input.mousePosition.x - currentPos.x) < -40){
					directInput = DirectionInput.Left;
					activeInput = false;
				}else if((Input.mousePosition.y - currentPos.y) > 40){
					directInput = DirectionInput.Up;
					activeInput = false;
				}else if((Input.mousePosition.y - currentPos.y) < -40){
					directInput = DirectionInput.Down;
					activeInput = false;
				}
			}else{
				directInput = DirectionInput.Null;
			}
			
		}
		if(Input.GetMouseButtonUp(0)){
			directInput = DirectionInput.Null;	
		}
		currentPos = Input.mousePosition;
	}
        public StateController <CharacterState, CharacterContext> BuildCharacterControllerImpl(StateControllerBuilder <CharacterState, CharacterContext> builder)
        {
            Builder = builder;
            InjectState(this);

            // Declare Smash Attacks
            SmashUp.Charge.Data.SmashAttack   = SmashAttack.Charge;
            SmashSide.Charge.Data.SmashAttack = SmashAttack.Charge;
            SmashDown.Charge.Data.SmashAttack = SmashAttack.Charge;

            SmashUp.Attack.Data.SmashAttack   = SmashAttack.Attack;
            SmashSide.Attack.Data.SmashAttack = SmashAttack.Attack;
            SmashDown.Attack.Data.SmashAttack = SmashAttack.Attack;

            // Ground Attacks
            new [] { Idle, Walk, CrouchStart, Crouch, CrouchEnd }
            // Smash Attacks
            .AddTransitions <CharacterState, CharacterContext>(context => {
                var input = context.Input;
                if (!input.Attack.WasPressed)
                {
                    return(null);
                }
                switch (input.Smash.Direction)
                {
                case Direction.Right:
                case Direction.Left:
                    return(SmashSide.Charge);

                case Direction.Up:
                    return(SmashUp.Charge);

                case Direction.Down:
                    return(SmashDown.Charge);
                }
                return(null);
            })
            // Tilt Attacks
            .AddTransitions <CharacterState, CharacterContext>(context => {
                var input = context.Input;
                if (!input.Attack.WasPressed)
                {
                    return(null);
                }
                switch (input.Movement.Direction)
                {
                case Direction.Right:
                case Direction.Left:
                    return(TiltSide);

                case Direction.Up:
                    return(TiltUp);

                case Direction.Down:
                    return(TiltDown);
                }
                return(Neutral);
            });
            SmashUp.Charge.AddTransitionTo(SmashUp.Attack);
            SmashDown.Charge.AddTransitionTo(SmashDown.Attack);
            SmashSide.Charge.AddTransitionTo(SmashSide.Attack);
            TiltDown.AddTransitionTo(Crouch, Input(i => i.Movement.Direction == Direction.Down));
            new[] { Neutral, TiltUp, TiltDown, TiltSide, SmashUp.Attack, SmashDown.Attack, SmashSide.Attack }
            .AddTransitionTo(Idle);

            new [] { Fall, Jump, JumpAerial }
            .AddTransitions(Land, ctx => ctx.IsGrounded)
            // Aerial Attacks
            .AddTransitions <CharacterState, CharacterContext>(context => {
                var input = context.Input;
                if (!input.Attack.WasPressed)
                {
                    return(null);
                }
                switch (input.Movement.Direction)
                {
                case Direction.Right:
                    return(context.Direction >= 0f ? AerialForward : AerialBackward);

                case Direction.Left:
                    return(context.Direction >= 0f ? AerialBackward : AerialForward);

                case Direction.Up:
                    return(AerialUp);

                case Direction.Down:
                    return(AerialDown);
                }
                return(AerialNeutral);
            });
            new[] { AerialForward, AerialBackward, AerialDown, AerialUp, AerialNeutral }
            .AddTransitions(AerialAttackLand, ctx => ctx.IsGrounded)
            .AddTransitionTo(Fall);
            AerialAttackLand.AddTransitionTo(Idle);

            // Aerial Movement
            new [] { Idle, Walk, Dash, Run, RunTurn, RunBrake, CrouchStart, Crouch, CrouchEnd, Shield.Main }
            .AddTransitions(JumpStart, ctx => ctx.Input.Jump.WasPressed && ctx.CanJump);
            new[] { JumpStart, JumpAerial }.AddTransitionTo(Jump);
            new[] { Jump, Fall }.AddTransitions(JumpAerial, ctx => ctx.Input.Jump.WasPressed && ctx.CanJump)
            .AddTransitions(EscapeAir, Input(i => i.Shield.WasPressed));
            Jump.AddTransition(Idle, ctx => ctx.NormalizedStateTime >= 1.0f && ctx.IsGrounded)
            .AddTransition(Fall, ctx => ctx.NormalizedStateTime >= 1.0f && !ctx.IsGrounded);
            EscapeAir.AddTransitionTo(FallHelpless);
            new[] { Fall, FallHelpless, EscapeAir }.AddTransitions(Land, ctx => ctx.IsGrounded);
            Land.AddTransitionTo(Idle);

            Func <Func <PlayerInputContext, DirectionalInput>, Func <CharacterContext, bool> >
            movementContext = func => {
                return(ctx => !DirectionInput(Direction.Down)(ctx) &&
                       Input(i => Mathf.Abs(func(i).Value.x) > DirectionalInput.DeadZone)(ctx));
            };

            // Running States
            Idle.AddTransition(Dash, movementContext(i => i.Smash));
            Dash.AddTransitionTo(Idle, DirectionInput(Direction.Neutral));
            new[] { Dash, RunTurn }.AddTransitionTo(Run);
            Run.AddTransition(RunBrake, DirectionInput(Direction.Neutral));
            Run.AddTransition(RunTurn,
                              ctx => !Mathf.Approximately(Mathf.Sign(ctx.Input.Movement.Value.x), Mathf.Sign(ctx.Direction)));
            RunBrake.AddTransitionTo(Idle);

            // Ground Movement
            new[] { Idle, Walk, Run }
            .AddTransitions(CrouchStart, DirectionInput(Direction.Down))
            .AddTransitions(Fall, ctx => !ctx.IsGrounded);

            Idle.AddTransition(Walk, movementContext(i => i.Movement));
            Walk.AddTransition(Idle, DirectionInput(Direction.Neutral));

            // Crouching States
            CrouchStart.AddTransitionTo(Crouch);
            CrouchEnd.AddTransitionTo(Idle);
            new[] { CrouchStart, Crouch, CrouchEnd }.AddTransitions(Fall, ctx => !ctx.IsGrounded);
            Crouch.AddTransition(CrouchEnd, Input(i => i.Movement.Direction != Direction.Down));

            // Ledge States
            new[] { Idle, Fall, FallHelpless }.AddTransitions(LedgeGrab, ctx => ctx.State.IsGrabbingLedge);
            LedgeGrab.AddTransitionTo(LedgeIdle);
            LedgeIdle.AddTransition(LedgeRelease, ctx => !ctx.State.IsGrabbingLedge)
            .AddTransition(LedgeClimb, DirectionInput(Direction.Up))
            .AddTransition(LedgeJump, ctx => ctx.Input.Jump.WasPressed && ctx.CanJump)
            .AddTransition(LedgeAttack, Attack());
            LedgeJump.AddTransitionTo(Jump);
            new[] { LedgeRelease, LedgeClimb, LedgeEscape, LedgeAttack }
            .AddTransitions(Idle, ctx => ctx.NormalizedStateTime >= 1.0f && ctx.IsGrounded)
            .AddTransitions(Fall, ctx => ctx.NormalizedStateTime >= 1.0f && !ctx.IsGrounded);

            // Shielding
            Idle.AddTransition(Shield.On, Input(i => i.Shield.Current));
            Shield.On.AddTransition(Shield.Perfect, ctx => ctx.State.IsHit)
            .AddTransitionTo(Shield.Main);
            Shield.Main.AddTransition(Shield.Broken, ctx => ctx.State.ShieldDamage <= 0)
            .AddTransition(Shield.Off, Input(i => !i.Shield.Current));
            Shield.Off.AddTransitionTo(Idle);
            new[] { Shield.Broken, Shield.Stunned, Idle }.Chain();

            // Rolls/Sidesteps
            Shield.Main
            .AddTransition(EscapeForward, ctx => {
                if (ctx.Direction > 0f)
                {
                    return(DirectionalSmash(Direction.Right)(ctx));
                }
                else
                {
                    return(DirectionalSmash(Direction.Left)(ctx));
                }
            })
            .AddTransition(EscapeBackward, ctx => {
                if (ctx.Direction > 0f)
                {
                    return(DirectionalSmash(Direction.Left)(ctx));
                }
                else
                {
                    return(DirectionalSmash(Direction.Right)(ctx));
                }
            })
            .AddTransition(Escape, DirectionInput(Direction.Down));
            new[] { Escape, EscapeForward, EscapeBackward }.AddTransitionTo(Shield.Main);

            Builder.WithDefaultState(Idle);
            BuildCharacterController();
            return(Builder.Build());
        }
Пример #17
0
    private void DirectionAngleInput()
    {
        if (Input.GetMouseButtonDown(0))
        {
            currentPos  = Input.mousePosition;
            activeInput = true;
        }

        if (Input.GetMouseButton(0) && checkSideCollision == false)
        {
            if (activeInput)
            {
                float ang = CalculateAngle.GetAngle(currentPos, Input.mousePosition);
                if ((Input.mousePosition.x - currentPos.x) > 20)
                {
                    if (ang < 45 && ang > -45)
                    {
                        directInput = DirectionInput.Right;
                        activeInput = false;
                    }
                    else if (ang >= 45)
                    {
                        directInput = DirectionInput.Up;
                        activeInput = false;
                    }
                    else if (ang <= -45)
                    {
                        directInput = DirectionInput.Down;
                        activeInput = false;
                    }
                }
                else if ((Input.mousePosition.x - currentPos.x) < -20)
                {
                    if (ang < 45 && ang > -45)
                    {
                        directInput = DirectionInput.Left;
                        activeInput = false;
                    }
                    else if (ang >= 45)
                    {
                        directInput = DirectionInput.Down;
                        activeInput = false;
                    }
                    else if (ang <= -45)
                    {
                        directInput = DirectionInput.Up;
                        activeInput = false;
                    }
                }
                else if ((Input.mousePosition.y - currentPos.y) > 20)
                {
                    if ((Input.mousePosition.x - currentPos.x) > 0)
                    {
                        if (ang > 45 && ang <= 90)
                        {
                            directInput = DirectionInput.Up;
                            activeInput = false;
                        }
                        else if (ang <= 45 && ang >= -45)
                        {
                            directInput = DirectionInput.Right;
                            activeInput = false;
                        }
                    }
                    else if ((Input.mousePosition.x - currentPos.x) < 0)
                    {
                        if (ang < -45 && ang >= -89)
                        {
                            directInput = DirectionInput.Up;
                            activeInput = false;
                        }
                        else if (ang >= -45)
                        {
                            directInput = DirectionInput.Left;
                            activeInput = false;
                        }
                    }
                }
                else if ((Input.mousePosition.y - currentPos.y) < -20)
                {
                    if ((Input.mousePosition.x - currentPos.x) > 0)
                    {
                        if (ang > -89 && ang < -45)
                        {
                            directInput = DirectionInput.Down;
                            activeInput = false;
                        }
                        else if (ang >= -45)
                        {
                            directInput = DirectionInput.Right;
                            activeInput = false;
                        }
                    }
                    else if ((Input.mousePosition.x - currentPos.x) < 0)
                    {
                        if (ang > 45 && ang < 89)
                        {
                            directInput = DirectionInput.Down;
                            activeInput = false;
                        }
                        else if (ang <= 45)
                        {
                            directInput = DirectionInput.Left;
                            activeInput = false;
                        }
                    }
                }
            }
        }

        if (Input.GetMouseButtonUp(0))
        {
            directInput = DirectionInput.Null;
            activeInput = false;
        }
    }
Пример #18
0
	private void DirectionAngleInput(){
		if(Input.GetMouseButtonDown(0)){
			currentPos = Input.mousePosition;
			activeInput = true;
		}
		
		if(Input.GetMouseButton(0) && checkSideCollision == false){
			if(activeInput){
				float ang = CalculateAngle.GetAngle(currentPos, Input.mousePosition);
				if((Input.mousePosition.x - currentPos.x) > 20){
					if(ang < 45 && ang > -45){
						directInput = DirectionInput.Right;
						activeInput = false;
					}else if(ang >= 45){
						directInput = DirectionInput.Up;
						activeInput = false;
					}else if(ang <= -45){
						directInput = DirectionInput.Down;
						activeInput = false;
					}
				}else if((Input.mousePosition.x - currentPos.x) < -20){
					if(ang < 45 && ang > -45){
						directInput = DirectionInput.Left;
						activeInput = false;
					}else if(ang >= 45){
						directInput = DirectionInput.Down;
						activeInput = false;
					}else if(ang <= -45){
						directInput = DirectionInput.Up;
						activeInput = false;
					}
				}else if((Input.mousePosition.y - currentPos.y) > 20){
					if((Input.mousePosition.x - currentPos.x) > 0){
						if(ang > 45 && ang <= 90){
							directInput = DirectionInput.Up;
							activeInput = false;
						}else if(ang <= 45 && ang >= -45){
							directInput = DirectionInput.Right;
							activeInput = false;
						}
					}else if((Input.mousePosition.x - currentPos.x) < 0){
						if(ang < -45 && ang >= -89){
							directInput = DirectionInput.Up;
							activeInput = false;
						}else if(ang >= -45){
							directInput = DirectionInput.Left;
							activeInput = false;
						}
					}
				}else if((Input.mousePosition.y - currentPos.y) < -20){
					if((Input.mousePosition.x - currentPos.x) > 0){
						if(ang > -89 && ang < -45){
							directInput = DirectionInput.Down;
							activeInput = false;
						}else if(ang >= -45){
							directInput = DirectionInput.Right;
							activeInput = false;
						}
					}else if((Input.mousePosition.x - currentPos.x) < 0){
						if(ang > 45 && ang < 89){
							directInput = DirectionInput.Down;
							activeInput = false;
						}else if(ang <= 45){
							directInput = DirectionInput.Left;
							activeInput = false;
						}
					}
					
				}
			}
		}
		
		if(Input.GetMouseButtonUp(0)){
			directInput = DirectionInput.Null;	
			activeInput = false;
		}
		
	}
Пример #19
0
    //Key input method
    private void KeyInput()
    {
        if (Input.anyKeyDown) {
            activeInput = true;
        }

        if (activeInput) {
            if (Input.GetKey (KeyCode.A)) {
                directInput = DirectionInput.Left;
                activeInput = false;
            } else

                if (Input.GetKey (KeyCode.D)) {
                directInput = DirectionInput.Right;
                activeInput = false;
            } else

                if (Input.GetKey (KeyCode.W)) {
                directInput = DirectionInput.Up;
                activeInput = false;
            } else

                if (Input.GetKey (KeyCode.S)) {
                directInput = DirectionInput.Down;
                activeInput = false;
            }
        } else {
            directInput = DirectionInput.Null;
        }
    }