Example #1
0
 private void Awake()
 {
     input    = GetComponent <ShipInput>();
     launcher = GetComponent <ProjectileLauncher>();
     //projectileSequence = new List<ProjectileType>();
     //projectileSequence.Add(ProjectileType.Simple);
 }
 void Update()
 {
     if (ShipInput.IsShooting())
     {
         Shoot();
     }
 }
Example #3
0
 private void Update()
 {
     turnInput    = ShipInput.GetTurnAxis();
     thrustInput  = ShipInput.GetForwardThrust();
     brakingInput = ShipInput.IsBraking();
     HUD.GetComponent <HUDController>().UpdateFuelText(fuel);
 }
Example #4
0
    private void Start()
    {
        input   = GetComponent <ShipInput>();
        physics = GetComponent <ShipPhysics>();

        mainCamera = Camera.main.GetComponent <CameraBehaviour>();

        alive = true;

        InitColliders();

        inputState = State.playerInputs;
        lastState  = State.playerInputs;

        deathUI.SetActive(false);
        transform.position = GameObject.Find("worldCenter").transform.position - new Vector3(0f, 0f, GameObject.Find("worldCenter").GetComponent <outZone>().GetRadius() * 0.95f);
        possibleTargets    = new List <GameObject>();
        selectedTarget     = null;
        lockTimer          = 0f;

        GameObject[] allTurrets = GameObject.FindGameObjectsWithTag("TurretT2");
        foreach (GameObject go in allTurrets)
        {
            if (go.transform.root.gameObject == gameObject)
            {
                turret = go;
                GetComponentInChildren <WeaponShootManager>().AddTurret(turret);
                maxHealth = 2000f;
                health    = maxHealth;
                break;
            }
        }
    }
Example #5
0
 private void Start()
 {
     rotationFilter = new Filter(GameplaySettings.Ship.RotationFilterParam, 0f);
     moveFilter     = new Filter(GameplaySettings.Ship.MoveFilterParam, 0f);
     settings       = GameplaySettings.Ship;
     shipInput      = new ShipInput();
 }
Example #6
0
 void Update()
 {
     if (ShipInput.IsHyperspacing())
     {
         HyperSpace(); return;
     }
     turnInput   = ShipInput.GetTurnAxis();
     thrustInput = ShipInput.GetForwardThrust();
 }
Example #7
0
    // Start is called before the first frame update
    void Start()
    {
        shipState = 0;

        al      = GetComponent <Altitude>();
        input   = GetComponent <ShipInput>();
        physics = GetComponent <ShipPhysics>();
        rb      = GetComponent <Rigidbody>();
    }
Example #8
0
    // Use this for initialization

    private void Awake()
    {
        DontDestroyOnLoad(gameObject);

        shipInput = GetComponent <ShipInput>();

        if (!shipInput)
        {
            Debug.Log("ShipInput component is missing");
        }
    }
Example #9
0
    // Use this for initialization
    void Start()
    {
        agent = gameObject.GetComponent<Agent>();
        input = gameObject.GetComponent<ShipInput>();

        rotate = agent.Rotation;
        speed = agent.Speed;

        heading = transform.rotation.eulerAngles.y - 90;
        leftsteer = 0.0f;
        rightsteer = 0.0f;
        lefttheta = 0.0f;
        righttheta = 0.0f;
    }
    public void Enable()
    {
        if (shipInput == null)
        {
            shipInput = new ShipInput();
            shipInput.ShipControls.Mouse.performed       += (ctx) => mouseInput = ctx.ReadValue <Vector2>();
            shipInput.ShipControls.Throttle.performed    += (ctx) => UpdateThrottle(ctx.ReadValue <float>());
            shipInput.ShipControls.AD.performed          += (ctx) => rollInput = ctx.ReadValue <float>();
            shipInput.ShipControls.FreeLook.performed    += (ctx) => freeLook = !freeLook;
            shipInput.ShipControls.FirePrimary.performed += (ctx) => firePrimary = !firePrimary;
        }

        shipInput.Enable();
    }
Example #11
0
 /// <summary>
 /// SHIP
 /// </summary>
 public FstiResult Ship(FstiToken token, ShipInput input)
 {
     using (var fstiService = this._fstiHelper.CreateFSTIService())
     {
         string result = fstiService.SHIPIByLot(token.Token.ToString(),
                                                input.CoNumber,
                                                input.CoLineNumber.ToString(),
                                                input.ShippedQuantity.ToString("0.000000"),
                                                input.Stockroom,
                                                input.Bin,
                                                input.InventoryCategory,
                                                input.LotNumber);
         return(FstiResult.Build(result));
     }
 }
Example #12
0
    public void ApplyInput(ShipInput input)
    {
        transform.RotateAround(transform.position, transform.forward, -180 * Time.fixedDeltaTime * input.leftRight);

        if (input.fire && currentFireCooldown <= 0)
        {
            float      shipRadius = ((CircleCollider2D)collider2D).radius;
            GameObject newBullet  =
                (GameObject)Instantiate(bulletPrefab, transform.position + transform.up * shipRadius * 1.8f, transform.rotation);

            Vector2 currentVelocity = rigidbody2D.velocity;
            Vector2 fireVelocity    = transform.up * fireSpeed;
            newBullet.rigidbody2D.velocity = currentVelocity + fireVelocity;
            newBullet.GetComponent <BulletController>().lifetime = bulletLifetime;

            currentFireCooldown = fireCooldown;
            shootParticles.Play();

            newBullet.audio.enabled = true;
            newBullet.audio.clip    = Utilities.ChooseRandom(shootSounds);
            newBullet.audio.Play();
        }

        if (input.forward > 0)
        {
            rigidbody2D.AddForce(transform.up * input.forward * 500);
            foreach (ParticleSystem particles in thrustParticles)
            {
                particles.Play();
            }
        }
        else
        {
            foreach (ParticleSystem particles in thrustParticles)
            {
                particles.Stop();
            }
        }
    }
Example #13
0
    public override void Action()
    {
        PlayerMovement pm = FindObjectOfType <PlayerMovement>();
        MouseLook      ml = FindObjectOfType <MouseLook>();
        ShipInput      si = FindObjectOfType <ShipInput>();

        if (!pm.isFlyingShip)
        {
            Cursor.lockState = CursorLockMode.None;
            pm.GetComponent <Rigidbody>().useGravity  = false;
            pm.GetComponent <Rigidbody>().isKinematic = true;
            pm.isFlyingShip = true;
            ml.isFlyingShip = true;
            si.enabled      = true;
        }
        else
        {
            Cursor.lockState = CursorLockMode.Locked;
            pm.isFlyingShip  = false;
            ml.isFlyingShip  = false;
            si.enabled       = false;
        }
    }
Example #14
0
 private void Awake()
 {
     input   = GetComponent <ShipInput>();
     physics = GetComponent <ShipPhysics>();
 }
Example #15
0
 private void Awake()
 {
     input  = GetComponent <ShipInput>();
     weapon = GetComponent <PrimaryWeapon>();
 }
	void Awake()
	{
		animator = GetComponent<Animator>();
		shipInput = GetComponent<ShipInput>();
	}
Example #17
0
 private void Awake()
 {
     shipInput = GetComponent <ShipInput>();
 }
Example #18
0
 void Awake()
 {
     s_Rigidbody = GetComponent <Rigidbody>();
     s_Input     = GetComponent <ShipInput>();
     s_Animator  = GetComponent <Animator>();
 }
Example #19
0
 public void ReceiveInput(ShipInput _inputToRecieve)
 {
     currentInput = _inputToRecieve;
 }
Example #20
0
 private void Awake()
 {
     playerInput  = GetComponent <ShipInput>();
     shotSequence = GetComponent <ShotSequence>();
     engine       = GetComponent <ShipEngine>();
 }
Example #21
0
        /// <summary>
        /// Reads the keyboard and Xbox 360 Controller to determine what the player is doing
        /// </summary>
        /// <param name="playerIndex"></param>
        public override void ReadSpaceShipInputs(PlayerIndex playerIndex)
        {
            GamePadState gamePadState = GamePad.GetState(playerIndex);

            ShipInput.Reset();

            // Pitch, Yaw, and Roll.
            ShipInput.PitchAngle = gamePadState.ThumbSticks.Right.Y;
            ShipInput.YawAngle   = gamePadState.ThumbSticks.Right.X;
            ShipInput.RollAngle  = gamePadState.ThumbSticks.Left.X;

            // Keyboard control
            KeyboardState keyState = Keyboard.GetState();

            if (keyState.IsKeyDown(Keys.Up))
            {
                ShipInput.PitchAngle = 1.0f;
            }

            if (keyState.IsKeyDown(Keys.Down))
            {
                ShipInput.PitchAngle = -1.0f;
            }

            if (keyState.IsKeyDown(Keys.Left))
            {
                ShipInput.YawAngle = -1.0f;
            }

            if (keyState.IsKeyDown(Keys.Right))
            {
                ShipInput.YawAngle = 1.0f;
            }

            if (keyState.IsKeyDown(Keys.A))
            {
                ShipInput.RollAngle = -1.0f;
            }

            if (keyState.IsKeyDown(Keys.D))
            {
                ShipInput.RollAngle = 1.0f;
            }

            ShipInput.SpeedOffset = gamePadState.ThumbSticks.Left.Y;

            ShipInput.Fired = (gamePadState.Triggers.Right > 0.5f);

            // Keyboard control - pt2
            if (keyState.IsKeyDown(Keys.W))
            {
                ShipInput.SpeedOffset = 1.0f;
            }

            if (keyState.IsKeyDown(Keys.S))
            {
                ShipInput.SpeedOffset = -1.0f;
            }

            if (keyState.IsKeyDown(Keys.Space))
            {
                ShipInput.Fired = true;
            }

            base.ReadSpaceShipInputs(playerIndex);
        }