Пример #1
0
    // Use this for initialization
    protected virtual void Start()
    {
        audioPlayed     = false;
        rayLine         = this.gameObject.GetComponent <LineRenderer>(); //attach linerenderer to field
        rayLine.enabled = false;                                         //turn off line draying by default

        //set inital interaction mode
        interactMode = InteractMode.Grab; //grab by default

        //set inital line colour
        rayLine.startColor = Color.white;
        rayLine.endColor   = Color.white;

        //set fields for this specific hand
        grabbing = false;
        sliding  = false;
        raising  = false;



        //change interaction mode to raycast for main menu
        if (SceneManager.GetActiveScene() == SceneManager.GetSceneByBuildIndex(0)) //scene 0 should be main menu
        {
            //set mode to raycast- things are far away and we cant touch them
            interactMode = InteractMode.Raycast;
        }
    }
 void Start()
 {
     im = GlobalVars.interact_mode;
     rm = GlobalVars.room_manager;
     dia = GlobalVars.description_ui;
     dm = GlobalVars.dialogue_manager;
 }
 void Start()
 {
     im = GlobalVars.interact_mode;
     aui = GlobalVars.action_text_ui;
     cui = GlobalVars.cursor_ui;
     inv = GlobalVars.inventory;
 }
    void Start()
    {
        mat = renderer.material;

        db = GlobalVars.database;
        im = GlobalVars.interact_mode;

        di = GlobalVars.dialogue_box;

        inv = GlobalVars.inventory;
    }
Пример #5
0
 public void SetInteractMode(InteractMode newMode)
 {
     interactMode = newMode;
     if (newMode == InteractMode.Combat)
     {
         GetComponent <CombatComponent>()?.SetIsEngaged(true);
     }
     else
     {
         GetComponent <CombatComponent>()?.SetIsEngaged(false);
     }
 }
    void Start()
    {
        im = GlobalVars.interact_mode;
        if(im == null)
            this.enabled = false;

        int BoxWidth = Screen.width / 18;
        Box = new Rect(Screen.width - BoxWidth * 2, Screen.height - BoxWidth * 1.5f, BoxWidth, BoxWidth);

        int IconWidth = Screen.width / 22;
        int dif = (BoxWidth - IconWidth) / 2;
        Icon = new Rect(Box.x + dif, Box.y + dif, IconWidth, IconWidth);
    }
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return(false);

            InteractMode m = (InteractMode)value;

            if (m.ToString().Equals((string)parameter))
            {
                return(true);
            }

            return(false);
        }
Пример #8
0
 public void enterHammerMode()
 {
     //techincally toggle hammerMode
     if (mode == InteractMode.HAMMER)
     {
         exitHammerMode();
     }
     else
     {
         mode = InteractMode.HAMMER;
         hammer.SetActive(true);
         nextPiece.gameObject.SetActive(false);
     }
 }
    void Start()
    {
        im = GlobalVars.interact_mode;

        Screen.showCursor = false;
        cursor_index = 0;

        cursorTextures = new Texture2D[CURSOR_COUNT];
        string base_path = "textures/GUI/cursor/";
        cursorTextures[0] = (Texture2D)Resources.Load(base_path + "blank");
        cursorTextures[1] = (Texture2D)Resources.Load(base_path + "identify");
        cursorTextures[2] = (Texture2D)Resources.Load(base_path + "use");
        cursorTextures[3] = (Texture2D)Resources.Load(base_path + "talk");
    }
    void Start()
    {
        im = GlobalVars.interact_mode;
        rm = GlobalVars.room_manager;
        dia = GlobalVars.dialogue_box;

        /*
        GameObject camera = GameObject.Find ("Main Camera");
        if(camera)
            di = camera.GetComponent<DrawInventory>();
        else
            di = null;
            */
    }
Пример #11
0
 public void enterBombMode()
 {
     //techincally toggle hammerMode
     if (mode == InteractMode.BOMB)
     {
         exitBombMode();
     }
     else
     {
         mode = InteractMode.BOMB;
         bomb.SetActive(true);
         nextPiece.gameObject.SetActive(false);
     }
 }
Пример #12
0
    // Start is called before the first frame update
    void Start()
    {
        currMode = InteractMode.NONE;

        EventManager.StartListening("LEFT", HandleLeft);
        EventManager.StartListening("RIGHT", HandleRight);
        EventManager.StartListening("SPACE", HandleJump);
        EventManager.StartListening("UP", HandleClimbUp);
        EventManager.StartListening("DOWN", HandleClimbDown);
        EventManager.StartListening("E_down", HandleInteract);
        EventManager.StartListening("SPACE_down", UseInteractable);

        EventManager.StartListening("ITEM_ACCEPTED", ItemAccepted);

        cc = GetComponent <CharacterController>();
    }
 private void CheckInteractMode()
 {
     if (trig == null) {
         curInteractMode = InteractMode.neutral;
     }
     else {
         if (trig.tag == "Bar") {
             curInteractMode = InteractMode.pickUp;
         }
         else if (trig.tag == "Customer" && foodInHand != null) {
             curInteractMode = InteractMode.putDown;
         }
         else {
             curInteractMode = InteractMode.neutral;
         }
     }
 }
        public InteractModeController(
            ILogger <InteractModeController> logger,
            IHttpContextAccessor httpContextAccessor,
            InteractMode MyInteractMode
            )
        {
            _logger    = logger;
            _questions = MyInteractMode;

            _httpContextAccessor = httpContextAccessor;
            ClaimsPrincipal currentUser = this.User;

            _user = (from c in _httpContextAccessor.HttpContext.User.Claims
                     where c.Type == "UserID"
                     select c.Value).FirstOrDefault()
            ;
        }
    public void Start()
    {
        im = GlobalVars.interact_mode;

        dm = GlobalVars.dialogue_manager;

        cui = GlobalVars.cursor_ui;

        dui = GlobalVars.description_ui;
        aui = GlobalVars.action_text_ui;

        if(GlobalVars.database == null || dm == null || im == null || GlobalVars.database == null)
            this.enabled = false; // dont run script if we are missing dependacies
        else
            myData = GlobalVars.database.GetCharacter(CharacterId);

        MouseOver = false;
    }
Пример #16
0
    void OnTriggerExit(Collider col)
    {
        if (col.tag == "Ladder")
        {
            canClimb = false;
        }

        if (col.tag == "Pickup")
        {
            pickup   = null;
            currMode = InteractMode.NONE;
        }
        if (col.tag == "Station")
        {
            station  = null;
            currMode = InteractMode.NONE;
        }
    }
Пример #17
0
        public void OnWindowStateChanged(object sender, EventArgs e)
        {
            InteractMode state = (InteractMode)sender;

            switch (state)
            {
            case InteractMode.MoveParty:
                r.MouseDown += rectangle_MouseDown;
                r.MouseMove += rectangle_MouseMove;
                r.MouseUp   += rectangle_MouseUp;
                break;

            case InteractMode.RevealMode:
            case InteractMode.MoveMapMode:
                r.MouseDown -= rectangle_MouseDown;
                r.MouseMove -= rectangle_MouseMove;
                r.MouseUp   -= rectangle_MouseUp;
                break;
            }
        }
Пример #18
0
    void OnTriggerStay(Collider col)
    {
        if (col.tag == "Ladder")
        {
            canClimb = true;
        }


        //if (col.gameObject.layer == 9 && interactable == null)
        //{
        //	interactable = col.gameObject;
        //}

        if (col.tag == "Pickup")
        {
            pickup   = col.gameObject;
            currMode = InteractMode.PICKUP;
        }
        else if (col.tag == "Station")
        {
            station  = col.gameObject;
            currMode = InteractMode.STATION;
        }
    }
Пример #19
0
        public void OnWindowStateChanged(object sender, EventArgs e)
        {
            InteractMode state = (InteractMode )sender;

            switch (state)
            {
            case InteractMode.RevealMode:
            case InteractMode.MoveParty:
                this.MouseWheel                  -= child_MouseWheel;
                this.MouseLeftButtonDown         -= child_MouseLeftButtonDown;
                this.MouseLeftButtonUp           -= child_MouseLeftButtonUp;
                this.MouseMove                   -= child_MouseMove;
                this.PreviewMouseRightButtonDown -= new MouseButtonEventHandler(child_PreviewMouseRightButtonDown);
                break;

            case InteractMode.MoveMapMode:
                this.MouseWheel                  += child_MouseWheel;
                this.MouseLeftButtonDown         += child_MouseLeftButtonDown;
                this.MouseLeftButtonUp           += child_MouseLeftButtonUp;
                this.MouseMove                   += child_MouseMove;
                this.PreviewMouseRightButtonDown += new MouseButtonEventHandler(child_PreviewMouseRightButtonDown);
                break;
            }
        }
Пример #20
0
    public void gameOver(int status)
    {
        // if status == 1 then it's a win
        // TODO: we should change the game over dialog to be win or lose based on result
        bool aWin = false;

        if (status == 0)
        {
            aWin = checkForWin();
        }
        if (UIDisplayComponent)
        {
            mode = InteractMode.GAMEOVER;

            if (status == 1 || aWin)
            {
                UIDisplayComponent.showGameOver(true);
            }
            else
            {
                UIDisplayComponent.showGameOver(false);
            }
        }
    }
Пример #21
0
    // Update is called once per frame
    protected virtual void Update()
    {
        TrackMovement();
        Trigger();
        GripButton();

        SelectButton();
        //draw ray if we are in raycast mode
        if (interactMode == InteractMode.Raycast)
        {
            DrawLine();
        }

        //update highlight around interactables
        UpdateHighlight();

        if (SceneManager.GetActiveScene() != SceneManager.GetSceneByBuildIndex(0)) //scene 0 should be main menu
        {
            if (GameManager.Instance.isDead == true)
            {
                interactMode = InteractMode.Raycast;
            }
        }
    }
    public void Start()
    {
        im = GlobalVars.interact_mode;

        dm = GameObject.Find ("Main Camera").GetComponent<DialogueManager>();
    }
Пример #23
0
 // Start is called before the first frame update
 void Awake()
 {
     instance     = this;
     _currentMode = defaultMode;
 }
    void Start()
    {
        im = GlobalVars.interact_mode;

        MoveSpeed = 0.125f;
    }
Пример #25
0
 public void ChangeStormMode(InteractMode mode)
 {
     CurrentInteractMode = mode;
 }
Пример #26
0
    void Start()
    {
        inv = GlobalVars.inventory;
        db = GlobalVars.database;
        im = GlobalVars.interact_mode;
        ps = GlobalVars.plot_system;

        BoxWidth = Screen.width / 18;
        Box = new Rect(Screen.width - BoxWidth * 2, Screen.height - BoxWidth * 2, BoxWidth, BoxWidth);

        int IconWidth = Screen.width / 22;
        int dif = (BoxWidth - IconWidth) / 2;
        Icon = new Rect(Box.x + dif, Box.y + dif, IconWidth, IconWidth);

        Icon50 = new Rect(0, 0, 60, 60); // Create a default rectangle of 50x50 pixels, simply specify later where to locate it
        Icon45 = new Rect(0, 0, 45, 30); //Create a default rectangle of 45x30 pixels
        IconInventoryScalable = new Rect(0, 0, (Screen.width / 14), (Screen.width / 14)); //create an inventory box of scalable size depending on resolution
        LabelInventoryScalable = new Rect(0, 0, Screen.width / 14, Screen.width / 48); //create an inventory label of scalable size depending on resolution
        MenuButton = new Rect(0, 0, 200, 50); //Create a default menu button size
        InventoryBackground = new Rect(Screen.width / 10, Screen.height / 10, Screen.width - (Screen.width / 10)*2, Screen.height - (Screen.height / 10)*2);

        BookBackground = new Rect(Screen.width / 10, Screen.height / 10, Screen.width - ((Screen.width / 10) * 2), Screen.height - ((Screen.height / 10) * 2));
        BookTexture = (Texture2D)Resources.Load("textures/GUI/icons/open_bookfin2");
        Book.stretchHeight = true;
        Book.stretchWidth = true;

        Inventoryicon = (Texture2D)Resources.Load ("textures/GUI/icons/inventory");
        ps.ChangePlotStatus(PlotPointer.FirstFreeRoam);
    }
Пример #27
0
 public void exitHammerMode()
 {
     mode = InteractMode.NORMAL;
     hammer.SetActive(false);
     nextPiece.gameObject.SetActive(true);
 }
    void Start()
    {
        db = GlobalVars.database;
        if(db == null) // no database, means script cant do shit
            this.enabled = false;
        else
        {
            myObjectData = db.GetObject(object_id);

            if(myObjectData == null)
                this.enabled = false;
        }

        im = GlobalVars.interact_mode;

        aui = GlobalVars.action_text_ui;
        di = GlobalVars.description_ui;

        inv = GlobalVars.inventory;

        cui = GlobalVars.cursor_ui;

        MouseOver = false;
    }
Пример #29
0
 private void ChangeMode(InteractMode mode)
 {
     _currentMode.enabled = (false);
     _currentMode         = mode;
     _currentMode.enabled = true;
 }
Пример #30
0
 public void ChangeInteractMode(InteractMode mode)
 {
     CurrentInteractMode = mode;
     //Debug.Log(mode); // add using UnityEngine if uncommented.
 }
    public void Start()
    {
        dui = GlobalVars.dialogue_ui;
        inv = GlobalVars.inventory;
        db = GlobalVars.database;
        im = GlobalVars.interact_mode;
        ps = GlobalVars.plot_system;

        fui = gameObject.GetComponent<FailUI>();
    }
Пример #32
0
    public override void Tick(float deltaTime)
    {
        for (int i = 0; i < filters.Length; i++)
        {
            // cache variables
            Filter filter = filters[i];

            InventoryComponent  invComp        = filter.inventoryComponent;
            InputComponent      inputComp      = filter.inputComponent;
            InteractorComponent interactorComp = filter.interactorComponent;
            MovementComponent   movComp        = filter.movementComponent;

            // ----- logic -----
            CheckDistanceToInteractable(filter);
            FindVisibleTargets();

            // no longer used---------------------------
            InteractMode previous = interactorComp.interactMode;
            if (inputComp.GetKeyDown(KeyCode.Alpha1))
            {
                // move set none if previous was new to SetInteractMode
                interactorComp.SetInteractMode(InteractMode.PlacingPlanks);
                if (previous == InteractMode.PlacingPlanks)
                {
                    interactorComp.SetInteractMode(InteractMode.None);
                }
            }
            else if (inputComp.GetKeyDown(KeyCode.Alpha2))
            {
                interactorComp.SetInteractMode(InteractMode.Combat);
                if (previous == InteractMode.Combat)
                {
                    interactorComp.SetInteractMode(InteractMode.None);
                }
            }
            //--------------------------------------------------

            if (inputComp.GetKeyDown(KeyCode.E) || inputComp.GetButtonDown("Fire1"))
            {
                //AttemptWorldInteract(interactorComp, player.inventoryComponent, inputComp.worldInteractMask);
                //interactorComp.SetInteractMode(InteractMode.Object);
            }
            else if (inputComp.GetKeyDown(KeyCode.Escape))
            {
                interactorComp.interactMode = InteractMode.None;
                CartComponent tc = (CartComponent)interactorComp.currentInteractable;
                if (tc)
                {
                    tc.isTraveling = true;
                }
            }

            if (Vector3.Distance(filter.gameObject.transform.position, transportableComponent.transform.position) < 6f ||
                Vector3.Distance(filter.gameObject.transform.position, travelComponent.transform.position) < 6f && lightComponent.IsLightEnabled())
            {
                goapSystem?.SetLightState(true);
            }
            else
            {
                goapSystem?.SetLightState(false);
            }

            if (Vector3.Distance(filter.gameObject.transform.position, transportableComponent.transform.position) < 3f)
            {
                if (inputComp.GetKeyDown(KeyCode.B) || inputComp.GetButtonDown("Fire3"))
                {
                    //bookGO.SetActive(!bookGO.activeSelf);
                    movComp.alive = false;
                }
                else
                {
                    movComp.alive = true;
                }

                if (inputComp.GetKeyDown(KeyCode.M) || inputComp.GetButtonDown("Fire2"))
                {
                    //mapGO.SetActive(!mapGO.activeSelf);
                }

                if (inputComp.GetKeyDown(KeyCode.E) || inputComp.GetButtonDown("Fire1"))
                {
                    //if (invComp.treeResources > 0)
                    //{
                    //    //craftingSystem?.CraftPotion1();
                    //    //craftGO.SetActive(!craftGO.activeSelf);
                    //}
                }
            }
            else
            {
                /*toggleMapGO.SetActive(false);
                 * toggleBookGO.SetActive(false);
                 * craftGO.SetActive(false);*/
            }

            isCombat      = interactorComp.interactMode == InteractMode.Combat;
            actorLocation = interactorComp.gameObject.transform.position;
            if (interactorComp.interactMode == InteractMode.PlacingPlanks)
            {
                isPlacingPlanks = true;
                if (isPlacingPlanks)
                {
                    // Don't LogWarning this unity I'm sure you have your reasons but I don't like them.
                }
                // TODO remaing at last possible location if impossible position
                plankPlaceLocation   = inputComp.GetMouseHoverTransformPosition(inputComp.objectPlaceMask);
                plankPlaceLocation.y = 0f;

                //if (inputComp.GetMouseButtonDown(0))
                //{
                //    PlacePlank(invComp);
                //}
            }
            else
            {
                isPlacingPlanks = false;
                if (inputComp.GetMouseButtonDown(0))
                {
                    inputComp.GetMouseWorldLocation(out RaycastHit hit);
                }
            }
        }
        if (Vector3.Distance(lightComponent.transform.position, transportableComponent.transform.position) < 7 && !lightComponent.IsLightEnabled()) //Magic number. Remove this
        {
            //lightComponent.currentFuel = lightComponent.maxFuel;
        }
    }
    void Start()
    {
        rm = GlobalVars.room_manager;
        im = GlobalVars.interact_mode;
        aui = GlobalVars.action_text_ui;

        cui = GlobalVars.cursor_ui;

        MouseOver = false;
    }
Пример #34
0
 public void exitBombMode()
 {
     mode = InteractMode.NORMAL;
     bomb.SetActive(false);
     nextPiece.gameObject.SetActive(true);
 }
    void Start()
    {
        room_visible = true;
        dia = GlobalVars.description_ui;
        im = GlobalVars.interact_mode;
        PlayerTF = GlobalVars.player_transform;

        room_cams = new Camera[rooms.Length];
        room_lis = new AudioListener[rooms.Length];
        room_spawn_points = new Vector3[rooms.Length];
        for(int i = 0; i < rooms.Length; i++)
        {
            Camera c = (Camera)(rooms[i].GetComponentInChildren<Camera>());
            c.enabled = false; // turn off camera
            room_cams[i] = c;

            AudioListener al = (AudioListener)(rooms[i].GetComponentInChildren<AudioListener>());
            al.enabled = false;
            room_lis[i] = al;

            room_spawn_points[i] = rooms[i].transform.Find("SPAWN_POINT").transform.position;
        }

        FullScreenRect = new Rect(0, 0, Screen.width, Screen.height);
        Col = Color.black;

        OverlayTexture = (Texture2D)Resources.Load ("textures/white");

        EnterRoom (room_cur);
    }