Ejemplo n.º 1
0
    public override void SimulateOwner()
    {
        var speed    = 40f;
        var movement = Vector3.zero;

        if (Input.GetKey(KeyCode.W))
        {
            movement.z += 10;
        }
        if (Input.GetKey(KeyCode.S))
        {
            movement.z -= 10;
        }
        if (Input.GetKey(KeyCode.A))
        {
            movement.x -= 10;
        }
        if (Input.GetKey(KeyCode.D))
        {
            movement.x += 10;
        }

        if (movement != Vector3.zero)
        {
            transform.position = transform.position + (movement.normalized * speed * BoltNetwork.FrameDeltaTime);
        }

        if (Input.GetKeyDown(KeyCode.F))
        {
            var flash = FlashColorEvent.Create(entity);
            flash.FlashColor = Color.red;
            flash.Send();
        }
    }
Ejemplo n.º 2
0
    public override void SimulateOwner()
    {
        var speed    = 4f;
        var movement = Vector3.zero;

        // movement
        if (Input.GetKey(KeyCode.W))
        {
            movement.z += 1;
        }
        if (Input.GetKey(KeyCode.S))
        {
            movement.z -= 1;
        }
        if (Input.GetKey(KeyCode.A))
        {
            movement.x -= 1;
        }
        if (Input.GetKey(KeyCode.D))
        {
            movement.x += 1;
        }

        // input for weapon selection
        if (Input.GetKeyDown(KeyCode.Alpha0))
        {
            state.WeaponActiveIndex = -1;
        }
        if (Input.GetKeyDown(KeyCode.Alpha1))
        {
            state.WeaponActiveIndex = 0;
        }
        if (Input.GetKeyDown(KeyCode.Alpha2))
        {
            state.WeaponActiveIndex = 1;
        }
        if (Input.GetKeyDown(KeyCode.Alpha3))
        {
            state.WeaponActiveIndex = 2;
        }


        // cube flashing input
        if (Input.GetKeyDown(KeyCode.F))
        {
            var flash = FlashColorEvent.Create(entity);
            flash.FlashColor = Color.red;
            flash.Send();
        }

        // actual transform movement
        if (movement != Vector3.zero)
        {
            transform.position = transform.position + (movement.normalized * speed * BoltNetwork.frameDeltaTime);
        }
    }
Ejemplo n.º 3
0
 //Entity event prend 1 parametre, sert a faire du feedback, jouer une explosion, etc
 public override void OnEvent(FlashColorEvent evnt)
 {
     resetColorTime          = Time.time + 0.2f;
     renderer.material.color = evnt.FlashColor;
 }
Ejemplo n.º 4
0
 public override void OnEvent(FlashColorEvent evnt)
 {
     resetColorTime = Time.time + 0.2f;
     GetComponent <Renderer>().material.color = evnt.FlashColor;
 }