// Use this for initialization
 void Awake()
 {
     anim = gameObject.GetComponent <Animator>();
     gameObject.transform.eulerAngles = rot;
     _controller = transform.root.GetComponent <ClickController>();
     _body       = transform.root.GetComponent <Rigidbody>();
 }
Exemple #2
0
 void Start()
 {
     startTransformParent = transform.parent;
     clickController      = FindObjectOfType <ClickController> ();
     terrainManager       = FindObjectOfType <TerrainManager> ();
     SetupDebugInventory();
 }
Exemple #3
0
    void Start()
    {
        Player = GameObject.Find("Player");
        mPlayerStatusScript = Player.GetComponent <PlayerStatusScript>();
        mSwipeController    = Player.GetComponent <SwipeController>();
        mClickController    = Player.GetComponent <ClickController>();
        mTriggerScript      = GameObject.Find("TriggerDaughter").GetComponent <TriggerScript>();
        mAudioSource        = GameObject.Find("ScreamSound2").GetComponent <AudioSource>();
        mButton             = (Texture2D)Resources.Load("btn_press");

        gameObjectPrefab = GameObject.FindGameObjectWithTag("Yuriko");
        AddAnimationSequence("MoveBackScript", 5.5f, false);

        IsEnabled        = false;
        IsCrawlOnly      = false;
        mActionSequence  = ActionSequence.CRAWL;
        mButtonSequence1 = (Texture2D)Resources.Load("1 copy");
        mButtonSequence2 = (Texture2D)Resources.Load("2 copy");
        mButtonSequence3 = (Texture2D)Resources.Load("3 copy");
        mButtonSequence4 = (Texture2D)Resources.Load("4 copy");

        mButton        = (Texture2D)Resources.Load("btn_press");
        mButtonPressed = (Texture2D)Resources.Load("gui_press");
        mSwipe         = (Texture2D)Resources.Load("gui_swipeLeft");
        MyStyle        = new GUIStyle();
    }
Exemple #4
0
        public static void AddCameraZoomController(AbstractCameraTracker camera, ClickController clickController)
        {
            if (TouchScreenEnabled)
            {
                var pinchGesture = new SmartGesture(GestureType.Pinch)
                {
                    GestureEvent = gesture =>
                    {
                        var dist = Vector2.Distance(gesture.Position, gesture.Position2);

                        var aOld    = gesture.Position - gesture.Delta;
                        var bOld    = gesture.Position2 - gesture.Delta2;
                        var distOld = Vector2.Distance(aOld, bOld);

                        var scale = (distOld - dist) / 500f;
                        camera.Zoom(scale);
                    }
                };
                clickController.TouchScreenControl.AddSmartGesture(pinchGesture);
            }
            if (KeyboardMouseEnabled)
            {
                clickController.MouseControl.OnScrollEvent += zoomBy =>
                {
                    camera.Zoom((float)zoomBy / 1000);
                };
            }
        }
Exemple #5
0
    void Start()
    {
        gameObjectPrefab    = GameObject.FindGameObjectWithTag("Father");
        mPlayerStatusScript = GameObject.Find("Player").GetComponent <PlayerStatusScript>();
        mClickController    = GameObject.Find("Player").GetComponent <ClickController>();
        mSwipeController    = GameObject.Find("Player").GetComponent <SwipeController>();
        mTriggerScript      = GameObject.Find("TriggerFather").GetComponent <TriggerScript>();
        AddAnimationSequence("MoveScript", mTimeIdle, false);
        mAudioSource = GameObject.Find("ScreamSound").GetComponent <AudioSource>();


        mButton        = (Texture2D)Resources.Load("btn_press");
        mButtonPressed = (Texture2D)Resources.Load("gui_press");
        mSwipe         = (Texture2D)Resources.Load("gui_swipeRight");

        mTime         = 0.0f;
        mTimeIdle     = 0.0f;
        mTimeInput    = 3.0f;
        mImageTime    = 0.0f;
        mImageTimeMax = 0.5f;

        mValueX      = 0.45f;
        mValueY      = 0.45f;
        mValueOffSet = 0.1f;

        mIsCompleted   = false;
        mSetInitialVal = true;
        mIsDamaged     = false;
        //AddAnimationSequence("AttackScript", 2.0f, false);
        MyStyle = new GUIStyle();
    }
 public override bool clicked()
 {
     if (base.clicked())
     {
         if (!isGrabbed)
         {
             if (top == null)
             {
                 top = gameObject;
             }
             foreach (Rigidbody rb in top.GetComponentsInChildren <Rigidbody>(true))
             {
                 rb.isKinematic = true;
             }
             ClickController cc = FindObjectOfType <ClickController>();
             top.transform.position = cc.holdPos.transform.position;
             top.transform.rotation = cc.holdPos.transform.rotation;
             cc.onClick.AddListener(drop);
             top.transform.parent = FindObjectOfType <UnityTemplateProjects.SimplePlayerController>().transform;
             isGrabbed            = true;
             justGrabbed          = true;
         }
     }
     return(false);
 }
Exemple #7
0
 private void Start()
 {
     LevelTrust = levelTrustStatic[(int)Proffesion];
     dialogNum  = dialogNumStatic[(int)Proffesion];
     dialogSets = DialogData.instance.GetDialogSet(Proffesion);
     DayController.DayHasCome   += DayController_DayHasCome;
     DayController.NightHasCome += DayController_NightHasCome;
     buttonToDialog              = transform.GetChild(0).gameObject;
     cloud         = buttonToDialog.GetComponent <ClickController>();
     randomWalking = GetComponent <NpsAIRandomWalking>();
     if (dialogSets != null)
     {
         if (dialogNum + 1 == dialogSets[LevelTrust].Dialogs.Length)
         {
             if (LevelTrust == dialogSets.Length - 1)
             {
                 buttonToDialog.SetActive(false);
             }
         }
     }
     else
     {
         cloud.gameObject.SetActive(false);
     }
 }
Exemple #8
0
    void Awake()
    {
        currentButton = null;
        focusCamera   = null;

        clickController = GetComponent <ClickController>();
        manager         = GetComponent <GameManager>();
        workPanel.SetActive(false);
        zonesPanel.SetActive(false);
        resourcesPanel.SetActive(false);
        buildPanel.SetActive(false);
        characterStatPanel.SetActive(false);

        AddPanelsToList();
        AddButtonsToList();
        AddCharacterThumbnails();

        btn_Work.onClick.AddListener(() => { TogglePanel(workPanel); });
        btn_Cut.onClick.AddListener(() => { ToggleCut(btn_Cut); });

        btn_Zones.onClick.AddListener(() => { TogglePanel(zonesPanel); });
        btn_Stockpile.onClick.AddListener(() => { ToggleStockpilePlacement(btn_Stockpile); });

        btn_Resources.onClick.AddListener(() => { TogglePanel(resourcesPanel); });

        btn_Build.onClick.AddListener(() => { TogglePanel(buildPanel); });
        btn_WoodenWall.onClick.AddListener(() => { ToggleBuild(btn_WoodenWall); });
    }
 private void FindControllers()
 {
     clickController  = GameObject.FindWithTag("playerInputController").GetComponent <ClickController>();
     abilityButtons   = GameObject.FindWithTag("playerInputController").GetComponent <AbilityButtons>();
     sceneController  = GameObject.FindWithTag("sceneController").GetComponent <SceneController>();
     textBoxManager   = GameObject.FindWithTag("playerHUD").GetComponent <TextBoxManager>();
     starshipMovement = GameObject.FindWithTag("Player").GetComponent <StarshipMovement>();
 }
 void Start()
 {
     if (Instance != null)
     {
         Destroy(this);
         return;
     }
     Instance = this;
 }
Exemple #11
0
 void Start()
 {
     tag             = Tag.None;
     zone            = Zone.None;
     clickController = GameObject.Find("GameManager").GetComponent <ClickController>();
     buildManager    = GameObject.Find("GameManager").GetComponent <BuildManager>();
     ui    = GameObject.Find("GameManager").GetComponent <UIManager>();
     _lock = null;
     node  = GetComponent <Node>();
 }
Exemple #12
0
 private void Awake()
 {
     if (_instance != null && _instance != this)
     {
         Destroy(this);
     }
     else
     {
         _instance = this;
     }
 }
Exemple #13
0
//Main Methods
    // Start is called before the first frame update
    void Start()
    {
        canInteract     = true;
        clickController = gameObject.GetComponent <ClickController>();
        abilityButtons  = FindObjectOfType <UIController>().GetButtons();
        player          = FindObjectOfType <MotherShipController>();
        // TODO: Set variables up in GameTags to change these numbers to easily resettable variables
        abilityValues = new List <int> {
            GameTags.checkShipSendValue, 2, 3, 4, 5
        };
        shipScale = 0.5f;
    }
Exemple #14
0
    private void Start()
    {
        _pool = new Pool(_pointPrefab, _dotsParent);

        _clickController   = new ClickController();
        _routeView         = new RouteView(_pool, _dotsParent);
        _route             = new Route(_routeView);
        _pauseButtonScript = new PauseButtonScript(_pauseButton);
        _uIController      = new UIController(_movingObject);
        _movingObject.Init(_route);

        _clickController.onMouseClickAction         += _route.SetNewWayPoint;
        _pauseButtonScript.onPauseButtonClickAction += _uIController.OnPauseButtonClick;
    }
    public static ClickController GetClickController()
    {
        ClickController clickController = null;

        GameObject gameControllerObject = GameObject.FindWithTag("GameController");

        if (gameControllerObject != null)
        {
            clickController = gameControllerObject.GetComponentInChildren <ClickController>();
        }

        if (clickController == null)
        {
            Debug.Log("Cant find clickController script");
        }

        return(clickController);
    }
        protected AbstractRpgGameMode(EventHandler clickEvent)
        {
            _backButtonClickEvent = clickEvent;
            GuiManager            = new GuiManager();
            var backButton = new BackButtonGuiLayer
            {
                ClickEvent = clickEvent
            };

            GuiManager.AddGuiLayer(backButton);
            UpdateList = new List <IUpdate> {
                GuiManager
            };
            ClickController = new ClickController
            {
                MouseControl =
                {
                    OnPressedEvent = (state, mouseState) =>
                    {
                        if (!GuiManager.Interact(mouseState.Position))
                        {
                            ClickEvent?.Invoke(mouseState.Position);
                        }
                    }
                }
            };
            var moveGesture = new SmartGesture(GestureType.Tap)
            {
                GestureEvent = gesture =>
                {
                    var position = gesture.Position.ToPoint();
                    if (!GuiManager.Interact(position))
                    {
                        ClickEvent?.Invoke(position);
                    }
                }
            };

            ClickController.TouchScreenControl.AddSmartGesture(moveGesture);
            UpdateList.Add(ClickController);
        }
    void drop()
    {
        if (justGrabbed)
        {
            justGrabbed = false; return;
        }
        ClickController cc = FindObjectOfType <ClickController>();

        cc.onClick.RemoveListener(drop);

        if (top == null)
        {
            top = gameObject;
        }
        foreach (Rigidbody rb in top.GetComponentsInChildren <Rigidbody>(true))
        {
            rb.isKinematic = false;
        }
        top.transform.parent = null;
        isGrabbed            = false;
    }
Exemple #18
0
 public static void AddCameraMovementController(AbstractCameraTracker camera, ClickController clickController)
 {
     if (TouchScreenEnabled)
     {
         var dragGesture = new SmartGesture(GestureType.FreeDrag)
         {
             GestureEvent = gesture =>
             {
                 camera.Camera.Position -= gesture.Delta / camera.CameraZoom;
             }
         };
         clickController.AddSmartGesture(dragGesture);
         var doubleTap = new SmartGesture(GestureType.DoubleTap)
         {
             GestureEvent = gesture =>
             {
                 camera.ReFocus();
             }
         };
         clickController.AddSmartGesture(doubleTap);
     }
 }
 private void Awake()
 {
     ClickController = GetComponent <ClickController>();
     cellsUI         = FindObjectsOfType <CellView>().ToList();
 }
 private void Start()
 {
     playerClickController = FindObjectOfType <ClickController>();
     playerRb = playerClickController.gameObject.GetComponent <Rigidbody>();
 }
 void Start()
 {
     clickController          = new ClickController(this, _camera);
     cameraRotationController = new CameraRotationController(_camera.transform, cameraRotationRadius, cameraRotationSpeed);
 }
Exemple #22
0
 void Start()
 {
     blueprintRange  = 100;
     terrainManager  = FindObjectOfType <TerrainManager> ();
     clickController = FindObjectOfType <ClickController> ();
 }
Exemple #23
0
        protected MenuScreen(ViewportAdapter viewPort, IServiceProvider serviceProvider)
        {
            _camera = new Camera2D(viewPort)
            {
                Zoom = 1.0f
            };
            _serviceProvider = serviceProvider;
            MenuItems        = new List <MenuItem>();

            _clickController = new ClickController();
            _clickController.MouseControl.OnPressedEvent += (state, mouseState) =>
            {
                CheckClick(mouseState.Position.ToVector2());
            };
            var moveGesture = new SmartGesture(GestureType.Tap);

            moveGesture.GestureEvent += gesture =>
            {
                CheckClick(gesture.Position);
            };
            _clickController.TouchScreenControl.AddSmartGesture(moveGesture);
            var upButtons = new List <IButtonAble>
            {
                new DirectionGamePadButton(Buttons.DPadUp),
                new KeyButton(Keys.W),
                new KeyButton(Keys.Up)
            };
            var downButtons = new List <IButtonAble>
            {
                new DirectionGamePadButton(Buttons.DPadDown),
                new KeyButton(Keys.S),
                new KeyButton(Keys.Down)
            };
            var actionButtons = new List <IButtonAble>
            {
                new GamePadButton(Buttons.A),
                new KeyButton(Keys.E)
            };
            var upAction = new CompositeSmartButton(upButtons)
            {
                OnButtonJustPressed = (sender, args) =>
                {
                    Selected--;
                }
            };
            var downAction = new CompositeSmartButton(downButtons)
            {
                OnButtonJustPressed = (sender, args) =>
                {
                    Selected++;
                }
            };
            var action = new CompositeSmartButton(actionButtons)
            {
                OnButtonReleased = (sender, args) =>
                {
                    MenuItems[Selected].Action.Invoke();
                }
            };

            _controller = new SmartController();
            _controller.AddButton(upAction);
            _controller.AddButton(downAction);
            _controller.AddButton(action);
        }
Exemple #24
0
 void Start()
 {
     _textBox = GetComponent <TMP_Text>();
     _player  = FindObjectOfType <ClickController>();
     SwitchText(0, ClickStr);
 }
Exemple #25
0
    // Use this for initialization
    void Start()
    {
        mClickContoller = GameObject.Find("Player").GetComponent <ClickController>();

        layerMask = 0x1 << LayerMask.NameToLayer("InteractiveLayer");
    }
 private void Button_Click(object sender, EventArgs e)
 {
     ClickController.Click(sender);
 }