void Update()
    {
        if (Input.GetKeyDown(KeyCode.Space))
        {
            DroppedHive?.Invoke(transform.position + (transform.forward * 10));
        }

        // Get the horizontal and vertical axis.
        // By default they are mapped to the arrow keys.
        // The value is in the range -1 to 1
        float translation = Input.GetAxis("Vertical") * speed;
        float rotation    = Input.GetAxis("Horizontal") * rotationSpeed;

        anim.SetFloat("speed", translation);

        // Make it move 10 meters per second instead of 10 meters per frame...
        translation *= Time.deltaTime;
        rotation    *= Time.deltaTime;

        // Move translation along the object's z-axis
        transform.Translate(0, 0, translation);

        // Rotate around our y-axis
        transform.Rotate(0, rotation, 0);
    }
    public override void Update()
    {
        if (Input.GetKeyDown(KeyCode.Space))
        {
            DroppedHive?.Invoke(player.transform.position + (player.transform.forward * 10));
        }
        // Get the horizontal and vertical axis.
        // By default they are mapped to the arrow keys.
        // The value is in the range -1 to 1
        float translation = Input.GetAxis("Vertical");
        float rotation    = Input.GetAxis("Horizontal");

        anim.SetFloat("speed", translation);

        trans  += translation;
        rotate += rotation;

        /*Vector3 rot = transform.rotation.eulerAngles;
         * rot.y += rotate * rotationSpeed * Time.deltaTime;
         * rgBody.MoveRotation(Quaternion.Euler(rot));
         * rotate = 0;
         *
         * Vector3 move = transform.forward * trans;
         * rgBody.velocity = move * speed * Time.deltaTime;
         * trans = 0;*/
    }
Beispiel #3
0
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Space))
        {
            DroppedHive?.Invoke(transform.position + (transform.forward * 10));
        }
        // Get the horizontal and vertical axis.
        // By default they are mapped to the arrow keys.
        // The value is in the range -1 to 1
        float translation = Input.GetAxis("Vertical");
        float rotation    = Input.GetAxis("Horizontal");

        trans  += translation;
        rotate += rotation;
    }
Beispiel #4
0
    public override void Update()
    {
        if (Input.GetKeyDown(KeyCode.Space)) // something like this in MovePawn script
        {
            DroppedHive?.Invoke(player.transform.position + (player.transform.forward * 10));
        }
        // Get the horizontal and vertical axis.
        // By default they are mapped to the arrow keys.
        // The value is in the range -1 to 1
        float translation = Input.GetAxis("Vertical");
        float rotation    = Input.GetAxis("Horizontal");

        anim.SetFloat("speed", translation);

        trans  += translation;
        rotate += rotation;
    }
    public override void Update()
    {
        if (Input.GetKeyDown(KeyCode.Space))
        {
            //Debug.Log("Entered If statement");
            DroppedHive?.Invoke(player.transform.position + (player.transform.forward * 10));
        }
        // Get the horizontal and vertical axis.
        // By default they are mapped to the arrow keys.
        // The value is in the range -1 to 1
        float translation = Input.GetAxis("Vertical");
        float rotation    = Input.GetAxis("Horizontal");

        anim.SetFloat("Speed", translation);

        trans  += translation;
        rotate += rotation;
    }