예제 #1
0
    void OnGUI()
    {
        GUILayout.BeginArea(new Rect(Screen.width / 6, 0, Screen.width * 2 / 3, Screen.height * 0.3f), style);
        GUILayout.BeginHorizontal();

        if (GUILayout.Button("Pause", GUILayout.Height(Screen.height * 0.1f))) {
            GamePhase = GamePhase == GamePhases.MainMenu ? GamePhases.Game : GamePhases.MainMenu;
            print("hubahuba");
        }

        if (GUILayout.Button("move: " + controlMode.ToString(), GUILayout.Height(Screen.height * 0.1f))) {
            int cm = (int)controlMode + 1;
            if (cm >= ControlModesLength) {
                cm = 0;
            }
            controlMode = (ControlModes)cm;
        }

        GUILayout.Label("ACC: " + Input.acceleration.ToString(), GUILayout.Height(Screen.height * 0.1f));

        GUILayout.EndHorizontal();
        GUILayout.EndArea();

        if (_gamePhase == GamePhases.MainMenu) {

        }
    }
예제 #2
0
        public override void LoadContent()
        {
            base.LoadContent();
            dimension = this;
            state     = STATE_BIRTH;

            Lights = new BlindList3D();
            Lights.LoadContent();
            ambientLight = new AmbientLight();
            ambientLight.LoadContent();
            AddLight(ambientLight);

            FinalImage   = new RenderTarget2D(Global.device, Global.windowWidth, Global.windowHeight, false, SurfaceFormat.Color, DepthFormat.Depth24);
            OverlayImage = new RenderTarget2D(Global.device, Global.windowWidth, Global.windowHeight, false, SurfaceFormat.Color, DepthFormat.Depth24);
            TransImage   = new RenderTarget2D(Global.device, Global.windowWidth, Global.windowHeight, false, SurfaceFormat.Color, DepthFormat.Depth24);
            Overlays     = new BlindList3D();
            Overlays.LoadContent();
            Transparencies = new BlindList3D();
            Transparencies.LoadContent();

            skybox = new SkyBox();
            skybox.LoadContent();
            skybox.dimension = this;

            //OPTIONS
            wireFrame        = false;
            mouseSensitivity = 0.001f;
            keySensitivity   = 1f;
            gravity          = -0.4f;
            _DebugMode       = DebugModes.None;
            _ControlMode     = ControlModes.None;
            _UpdateMode      = UpdateModes.Normal;
            timeDilation     = 1f;
        }
예제 #3
0
        public static ControlDirection GetDirection(this ControlModes controlMode)
        {
            switch (controlMode)
            {
            case ControlModes.BreathIntensity:
                return(ControlDirection.X);

            case ControlModes.GazePointXRaw:
                return(ControlDirection.X);

            case ControlModes.GazePointXSmooth:
                return(ControlDirection.X);

            case ControlModes.GazePointY:
                return(ControlDirection.Y);

            case ControlModes.HeadPitch:
                return(ControlDirection.X);

            case ControlModes.HeadYaw:
                return(ControlDirection.X);

            case ControlModes.HeadRoll:
                return(ControlDirection.X);

            case ControlModes.HeadVelocity:
                return(ControlDirection.X);

            default:
                return(ControlDirection.X);
            }
        }
    void Start()
    {
        // Get the mode pref

        string mode = PlayerPrefs.GetString("Mode", "KNM");

        // Use it to set the mode of play

        switch (mode)
        {
        case "PNC":
            ControlMode = ControlModes.PointAndClick;
            break;

        case "KNM":
            ControlMode = ControlModes.Keyboard;
            break;
        }


        // Create a ref to the player objects character controller

        characterController =
            GetComponent <CharacterController>();

        // Get the navmesh agent for Point and Click

        characterAgent =
            GetComponent <NavMeshAgent>();

        // Create a ref to the main camera

        viewCamera = Camera.main;
    }
    void Start()
    {
        // Get the mode pref

        string mode = PlayerPrefs.GetString("Mode", "KNM");

        // Use it to set the mode of play

        switch(mode)
        {
            case "PNC":
                ControlMode = ControlModes.PointAndClick;
                break;
            case "KNM":
                ControlMode = ControlModes.Keyboard;
                break;
        }

        // Create a ref to the player objects character controller

        characterController = 
            GetComponent<CharacterController>();

        // Get the navmesh agent for Point and Click

        characterAgent =
            GetComponent<NavMeshAgent>();

        // Create a ref to the main camera

        viewCamera = Camera.main;
        
    }
예제 #6
0
 /// <summary>
 /// Load the player
 /// </summary>
 public override void Load()
 {
     Scale = 0.2f;
     if (Team == "blue")
     {
         SpriteColor = new Color(0.5f, 0.5f, 1.0f, 1f);
     }
     ControlMode = ControlModes.AI;
 }
예제 #7
0
    public void AutoTarget(Card card, ControlModes mode)
    {
        var target = card.GetAspect <Target> ();

        if (target == null)
        {
            return;
        }
        var mark       = mode == ControlModes.Computer ? target.preferred : target.allowed;
        var candidates = GetMarks(card, mark);

        target.selected = candidates.Count > 0 ? candidates.Random() : null;
    }
예제 #8
0
 /// <summary>
 /// Triggers a one time shake of the controller to a specified destination value
 /// </summary>
 public virtual void ToDestination()
 {
     if ((TargetObject == null) || (TargetAttribute == null))
     {
         return;
     }
     else
     {
         this.enabled         = true;
         ControlMode          = ControlModes.ToDestination;
         _shakeStartTimestamp = Time.time;
         _shaking             = true;
         _initialValue        = GetInitialValue();
     }
 }
예제 #9
0
    //Selecciona los posibles objetivos
    public void AutoTarget(Card card, ControlModes mode)
    {
        var target = card.GetAspect <Target> ();

        if (target == null)
        {
            return;
        }
        //En el modo IA marca los objetivos preferidos y en otro modo los permitidos
        var mark       = mode == ControlModes.Computer ? target.preferred : target.allowed;
        var candidates = GetMarks(card, mark);

        //Si la lista de candidatos tiene más de 0 lo escoge al azar
        target.selected = candidates.Count > 0 ? candidates.Random() : null;
    }
예제 #10
0
 public void Sync(GroupOverrides syncFrom)
 {
     MoveMode       = syncFrom.MoveMode;
     MaxSize        = syncFrom.MaxSize;
     MinSize        = syncFrom.MinSize;
     Neutrals       = syncFrom.Neutrals;
     Unowned        = syncFrom.Unowned;
     Friendly       = syncFrom.Friendly;
     Control        = syncFrom.Control;
     FocusTargets   = syncFrom.FocusTargets;
     FocusSubSystem = syncFrom.FocusSubSystem;
     SubSystem      = syncFrom.SubSystem;
     Meteors        = syncFrom.Meteors;
     Biologicals    = syncFrom.Biologicals;
     Projectiles    = syncFrom.Projectiles;
 }
예제 #11
0
    //Permite saber qué cartas se pueden jugar desde la mano
    public void Refresh(ControlModes mode)
    {
        var match        = container.GetMatch();
        var targetSystem = container.GetAspect <TargetSystem> ();

        playable.Clear();
        foreach (Card card in match.CurrentPlayer[Zones.Hand])
        {
            targetSystem.AutoTarget(card, mode);
            var playAction = new PlayCardAction(card);
            if (playAction.Validate())
            {
                playable.Add(card);
            }
        }
    }
예제 #12
0
        /// <summary>
        /// Triggers a one time shake of the shader controller
        /// </summary>
        public virtual void OneTime()
        {
            if (!CacheMaterial)
            {
                Initialization();
            }

            if (RendererIsNull() || (!PropertyFound))
            {
                return;
            }
            else
            {
                this.enabled      = true;
                ControlMode       = ControlModes.OneTime;
                _startedTimestamp = Time.time;
                _shaking          = true;
            }
        }
예제 #13
0
 public void Sync(GroupOverrides syncFrom)
 {
     MoveMode       = syncFrom.MoveMode;
     MaxSize        = syncFrom.MaxSize;
     MinSize        = syncFrom.MinSize;
     Neutrals       = syncFrom.Neutrals;
     Unowned        = syncFrom.Unowned;
     Friendly       = syncFrom.Friendly;
     Control        = syncFrom.Control;
     FocusTargets   = syncFrom.FocusTargets;
     FocusSubSystem = syncFrom.FocusSubSystem;
     SubSystem      = syncFrom.SubSystem;
     Meteors        = syncFrom.Meteors;
     Grids          = syncFrom.Grids;
     Biologicals    = syncFrom.Biologicals;
     Projectiles    = syncFrom.Projectiles;
     Repel          = syncFrom.Repel;
     CameraChannel  = syncFrom.CameraChannel;
     Debug          = syncFrom.Debug;
     LeadGroup      = syncFrom.LeadGroup;
 }
    void Start()
    {
        // Create a ref to the player objects character controller

        characterController = 
            GetComponent<CharacterController>();

        // Get the navmesh agent for Point and Click

        characterAgent =
            GetComponent<NavMeshAgent>();

        // Create a ref to the main camera

        viewCamera = Camera.main;

        // Set the default control mode

        ControlMode = 
            ControlModes.PointAndClick;
    }
예제 #15
0
    void Start()
    {
        // Create a ref to the player objects character controller

        characterController =
            GetComponent <CharacterController>();

        // Get the navmesh agent for Point and Click

        characterAgent =
            GetComponent <NavMeshAgent>();

        // Create a ref to the main camera

        viewCamera = Camera.main;

        // Set the default control mode

        ControlMode =
            ControlModes.PointAndClick;
    }
    void Update()
    {
        //Prevent updates if game is paused
        if (GlobalGame.Paused)
        {
            return;
        }

        switch (controlMode)
        {
        case ControlModes.BaseBuilding:
            BaseBuildingMovement();
            return;
        }


        //When control mode is player, init to reset values back to normal.
        if (initSwitchMode)
        {
            cameraMovement.XZMovementEnabled = false;
            cameraMovement.ZoomEnabled       = true;
            cameraAttachment.enabled         = true;
            cameraMovement.ZoomUpdate();
            initSwitchMode = false;
            return;
        }



        //Switch to basebuilding when pressed
        if (Input.GetKeyDown(SwitchMode))
        {
            print("Switching to BaseBuilding");
            controlMode            = ControlModes.BaseBuilding;
            GlobalGame.ControlMode = ControlModes.BaseBuilding;
            initSwitchMode         = true;
        }
    }
    void BaseBuildingMovement()
    {
        //Initiates base building camera settings and movement
        if (initSwitchMode)
        {
            cameraMovement.ZoomEnabled       = false;
            cam.transform.localPosition      = new Vector3(0, 25, -4.408f);
            cam.transform.localRotation      = Quaternion.Euler(80, 0, 0);
            cameraMovement.XZMovementEnabled = true;
            cameraAttachment.enabled         = false;
            initSwitchMode = false;
        }


        //Switch to playermode when pressed
        if (Input.GetKeyDown(SwitchMode))
        {
            print("Switching to Player");
            controlMode            = ControlModes.Player;
            GlobalGame.ControlMode = ControlModes.Player;
            initSwitchMode         = true;
        }
    }
예제 #18
0
 /// <summary>
 /// Triggers a one time shake of the controller to a specified destination value
 /// </summary>
 public virtual void ToDestination()
 {
     if (!CacheMaterial)
     {
         Initialization();
     }
     if (RendererIsNull() || (!PropertyFound))
     {
         return;
     }
     else
     {
         this.enabled = true;
         if (PropertyType == PropertyTypes.Color)
         {
             _fromColorStorage = FromColor;
             FromColor         = TargetMaterial.GetColor(PropertyID);
         }
         ControlMode       = ControlModes.ToDestination;
         _startedTimestamp = Time.time;
         _shaking          = true;
         _initialValue     = GetInitialValue();
     }
 }
예제 #19
0
 /// <summary>
 /// This change the UI to the corresponding control mode.
 /// If edit = enable editting the page.
 /// View = disable editting and show only the data in view mode.
 /// Delete = Allow deleting the items from the page.
 /// </summary>
 /// <param name="ControlMode">control mode to set the page</param>
 public abstract void UpdateUI(ControlModes ControlMode);
예제 #20
0
        /// <summary>
        /// Invokes the <see cref="Context"/>, initializing any objects in <see cref="Context.Instances"/> with the appropriate values.
        /// </summary>
        /// <param name="mode">Controls the scope of the invocation. View <see cref="ControlModes"/> for information on what these do.</param>
        public static void Invoke(ControlModes mode = ControlModes.RegisteredTypesOnly)
        {
            if (Context.Invoked)
            {
                throw new InvalidOperationException("Cannot invoke multiple times.");
            }

            if (mode == ControlModes.RegisteredTypesOnly)
            {
                Context.fields = new Lazy <ArgumentDictionary>(() =>
                                                               Context.Iterate(
                                                                   Context.Instances
                                                                   .Select(x => x.GetType())
                                                                   .Distinct()));
            }

            IEnumerable <string> alreadyUsedNames =
                Context.manualArguments
                .Where(x => fields.Value.ContainsKey(x.LongName))
                .Select(x => x.LongName)
                .Concat(
                    Context.manualArguments
                    .Where(x => fields.Value.ContainsKey(x.ShortName))
                    .Select(x => x.ShortName));

            if (alreadyUsedNames.Any())
            {
                throw new InvalidOperationException(
                          $"ArgumentGroup contained argument names already in use: {string.Join(", ", alreadyUsedNames)}");
            }

            Context.SetInstanceFieldValues(Context.Fields, Context.Instances);

            List <IArgument> userSupplied =
                Context.manualArguments.Invoke(Context.ParsedArgs).ToList();

            foreach (TreeNode <string> argument in
                     Context.ParsedArgs.Root.Children.Where(x =>
                                                            !userSupplied.Any(y => x.Value == y.LongName || x.Value == y.ShortName)))
            {
                if (fields.Value.ContainsKey(argument.Value))
                {
                    IEnumerable <AttributeField> currentPosition = fields.Value[argument.Value];
                    if (currentPosition.Count() == 1 &&                 // There is a single expected field for that attribute.
                        currentPosition.First().Attr.Position == -1 &&  // The only expected field is a flag.
                        argument.Children.Count == 0)                   // No value was supplied for the field.
                    {
                        Context.SetInstanceFieldValue(
                            "True",
                            currentPosition.First(),
                            Context.Instances);

                        userSupplied.Add(currentPosition.First().Attr);
                    }
                    else if (currentPosition.Count() == argument.Children.Count)
                    {
                        for (int counter = 0; counter < argument.Children.Count; counter++)
                        {
                            AttributeField currentField = currentPosition.ElementAt(counter);
                            Context.SetInstanceFieldValue(
                                argument.Children[counter].Value,
                                currentField,
                                Context.Instances);

                            userSupplied.Add(currentField.Attr);
                        }
                    }
                    else
                    {
                        throw new ArgumentException($"Malformed argument \"{argument.Value}\".");
                    }
                }
                else
                {
                    throw new ArgumentException($"Unrecognized argument \"{argument.Value}\".");
                }
            }

            IArgument[] remainingArguments =
                Context.Fields
                .Select(x => (IArgument)x.Attr)
                .Concat(Context.manualArguments)
                .Except(userSupplied)
                .ToArray();

            if (remainingArguments.Any(x => x.Required))
            {
                IEnumerable <string> missingRequiredArguments =
                    remainingArguments
                    .Where(x => x.Required)
                    .Select(x => $"{x.ShortName} ({x.LongName})");

                throw new ArgumentException(
                          $"Missing required arguments: {string.Join(", ", missingRequiredArguments)}");
            }

            Context.Invoked = true;
        }
예제 #21
0
      public bool SetControlMode(ControlModes mode)
      {
         int modeValue = -1;
         bool result = false;

         if (ControlModes.microStepper == mode)
         {
            modeValue = 3;
         }
         else if (ControlModes.singleLoopPosition == mode)
         {
            modeValue = 5;
         }

         if (modeValue > 0)
         {
            result = true;
            result &= this.ExchangeCommAction(new BinaryInterpreterSet("MO", 0, 0));
            result &= this.ExchangeCommAction(new BinaryInterpreterSet("UM", 0, modeValue));
            result &= this.ExchangeCommAction(new BinaryInterpreterSet("MO", 0, 1));
         }

         return (result);
      }