Exemple #1
0
        private void LaunchRocket(World world)
        {
            if (!RocketResources.HasEnoughForRocket(RocketMission.rocket))
            {
                return;
            }

            RocketResources.InvestInRocket(RocketMission.rocket);

            var target = Renderer.target.MapPixelToCoords(Input.mousePosition).ToVector2();

            if (!RocketMission.InTargetBounds(target.X))
            {
                return;
            }

            this.m_NextTimeFire = Time.time + 3f;

            var entity = world.CreateEntity(this.m_Arch);
            var spawn  = RocketMission.launchLocations[Player.playerId] + new Vector2(10f, -10f);

            world.SetComponentData <Position>(entity, new Position(spawn));
            world.SetComponentData <Rocket>(entity, new Rocket(Player.playerId, RocketMission.rocket, target));

            if (Player.isMultiplayer)
            {
                NetworkBuffer.Add(new RocketLaunchCommand(Player.playerId, RocketMission.rocket, target));
            }
        }
Exemple #2
0
        private void RenderCrosshair()
        {
            Vector2f position = Renderer.target.MapPixelToCoords(Input.mousePosition);

            if (RocketMission.InTargetBounds(position.X) && RocketResources.HasEnoughForRocket(RocketMission.rocket))
            {
                this.m_Crosshair.SetColor(Color.Yellow);
            }
            else
            {
                this.m_Crosshair.SetColor(Color.Red);
            }

            this.m_Crosshair.Render(position);
        }