Exemple #1
0
    // Update is called once per frame
    void Update()
    {
        RaycastHit hit     = new RaycastHit();
        Vector3    forward = Reticle.getInstance().transform.TransformDirection(Vector3.forward);

        // Create the ray that will be casted straight into the screen. It's origin is the coordinates
        // of the reticle after a click is detected. The destination is our forward vector.
        Ray castedRay = new Ray(Reticle.getInstance().transform.position, forward);

        // Check if the raycast hit anything, if so, acquire the game object that it hit using the 'out' struct.
        if (Physics.Raycast(castedRay, out hit))
        {
            // Acquire the game object information from the object that is hit. This allows for anybody
            // to query getObjectHitByRay() each frame for access to that object. This will be further used to
            // cycle textures.
            if (hit.collider.gameObject != null)
            {
                mLastObjectHit = hit.collider.gameObject;
            }
        }
        // Reset the last object hit reference each frame that nothing was hit.
        else
        {
            mLastObjectHit = null;
        }
    }
Exemple #2
0
    protected virtual void OnEnable()
    {
        //get recoil clip length, show it in inspector to compare with fire rate
        RuntimeAnimatorController rac = modelAnimator.runtimeAnimatorController;

        for (int i = 0; i < rac.animationClips.Length; i++)
        {
            if (rac.animationClips[i].name == "Recoil")
            {
                recoilAnimTime = rac.animationClips[i].length;
                break;
            }
        }

        fireRate = 1f / ((float)fireSpeed / 60f);
        recoilEffect.SetUp(this.transform.localRotation);

        gunAudio = GetComponent <AudioSource>();

        fireTimer   = 0f;
        currentAmmo = magazineSize;
        //ammoLeft = magazineSize * 4;	//when pick up a new gun, there are 5 cartridge ammo
        isReloading = false;
        UpdateAmmoUI();

        reticle = Camera.main.GetComponent <Reticle>();
    }
    void Start()
    {
        vr     = OpenVR.IsHmdPresent();
        seated = OpenVR.ChaperoneSetup == null;

        // FIXME Currently no Chaperone / SteamVR support
        seated = true;

        if (VRControls == null)
        {
            VRControls = GameObject.Find("VR Controls");
        }
        if (MainMenuControls == null)
        {
            MainMenuControls = GameObject.Find("Main Menu Controls");
        }
        if (InGameControls == null)
        {
            InGameControls = GameObject.Find("In-Game Controls");
        }
        if (Reticle == null)
        {
            Reticle = GameObject.Find("Reticle").GetComponent <Reticle>();
        }

        // Fix level select height displacement
        if (vr)
        {
            MainMenuControls.transform.localPosition = new Vector3(
                0f,
                0.5f,
                0f
                );
        }

        //InGameControls.transform.parent = Camera.main.transform;
        inGameButtons = new FloatingButton[InGameControls.transform.childCount];
        for (int i = 0; i < inGameButtons.Length; i++)
        {
            Transform childTransform = InGameControls.transform.GetChild(i);

            FloatingButton button = childTransform.GetComponent <FloatingButton>();
            if (button == null)
            {
                continue;
            }
            inGameButtons[i]      = button;
            button.ScaleFadeSpeed = 0f;
        }
        InGameControls.SetActive(false);

        SimpleSmoothMouseLook mouseLook = Camera.main.GetComponent <SimpleSmoothMouseLook>();

        if (mouseLook != null)
        {
            mouseLook.enabled = !vr;
        }

        SwitchLevel(null);
    }
Exemple #4
0
        /// <summary>
        /// Step 2: Add and configure scene UI objects. Currently, this should only be run when
        /// configuring the player
        /// </summary>
        /// <param name="rMotionController"></param>
        protected virtual void SetupSceneUI(MotionController rMotionController)
        {
            string lProgressTitle  = "Configuring Scene Objects (Step 2 of 6)";
            float  lProgressAmount = 2f / 6f;

            EditorUtility.DisplayProgressBar(lProgressTitle, "Base scene objects", lProgressAmount);

            GameObject lUIContainer = UISetupHelper.GetUIContainer();

            if (lUIContainer == null)
            {
                return;
            }

            if (UseReticle && ReticlePrefab != null)
            {
                Reticle lReticle = FindObjectOfType <Reticle>();
                if (lReticle == null)
                {
                    lReticle      = Instantiate(ReticlePrefab);
                    lReticle.name = ReticlePrefab.name;
                    lReticle.transform.SetParent(lUIContainer.transform);
                    lReticle.transform.Reset();
                }

                lReticle.IsVisible = ReticleStartVisible;
            }

            if (UsePlayerHUD)
            {
                Canvas lSceneCanvas = lUIContainer.GetComponentInChildren <Canvas>();
                SetupPlayerHUD(rMotionController, lSceneCanvas);
            }
        }
    void Awake()
    {
        HideTarget();

        // find reticle
        reticle = FindObjectOfType <Reticle>();

        if (reticle == null)
        {
            Debug.LogError("Reticle not found in the scene.");
        }

        if (showArc)
        {
            // get line renderer
            line = target.GetComponent <LineRenderer>();

            if (line == null)
            {
                Debug.LogError("Line Renderer not found on the target.");
            }

            // set number of arc points
            line.positionCount = arcPointCount;

            arcPoints = new Vector3[arcPointCount];
        }
    }
Exemple #6
0
    //deactivate a reticle residing in a target
    public void DeactivateFromTarget(Transform target)
    {
        //look for it
        Reticle r = target.GetComponentInChildren <Reticle>();

        if (r != null)
        {
            for (int i = 0; i < mActiveReticles.Count; i++)
            {
                ReticleHolder rh = mActiveReticles[i];
                EntityBase    e  = rh.targettedEntity;

                if (rh.reticle == r)
                {
                    //cache the reticle
                    r.transform.parent = transform;
                    r.gameObject.SetActiveRecursively(false);

                    if (e != null)
                    {
                        e.FlagsRemove(Entity.Flag.Targetted);
                        e.OnTargetted(false);
                    }

                    mActiveReticles.RemoveAt(i);
                    break;
                }
            }
        }
    }
    /// <summary>
    /// Makes bad stuff happen
    /// </summary>
    /// <param name="BadStuffCategories">The categories of which bad stuff happens - "Typing", "Targeting", or "Moving"</param>
    public void BadStuffHappens(params string[] BadStuffCategories)
    {
        if (HitPoints <= 0)
        {
            return;
        }

        var chosenCategory = new System.Random().Next(0, BadStuffCategories.Length);

        switch (BadStuffCategories[chosenCategory])
        {
        case "Targeting":
            Reticle.BadStuffHappens();
            break;

        case "Typing":
            GameManager.AlphabetManager.BadStuffHappens();
            Debug.Log("Make bad stuff happen to typing.");
            break;

        case "Moving":
            if (lastBadStuffTime < Time.time - 0.1f)     // For some reason, this fires like, 3 times at once
            {
                playerSpeedModifiers.Enqueue(Time.time + slowdownDuration);
                lastBadStuffTime = Time.time;
                Debug.Log("Player slowdowns: " + playerSpeedModifiers.Count);
                ChangeColor();
            }
            break;

        default:
            Debug.Log("Bad stuff happened while making bad stuff happen. Or just lose HP.");
            break;
        }
    }
Exemple #8
0
 void Start()
 {
     cameraTransform    = Camera.main.transform;
     mTransitionManager = FindObjectOfType <TransitionManager>();
     mReticle           = FindObjectOfType <Reticle>();
     GetComponent <Renderer>().material = nonFocusedMaterial;
 }
Exemple #9
0
    void PlaySound(AudioClip s)
    {
        AudioSource a = Reticle.getInstance().GetComponent <AudioSource> ();

        a.clip = s;
        a.Play();
    }
Exemple #10
0
    virtual public void WhipItOut()
    {
        MakeVisible();
        weaponRotLocked = false;
        transform.Rotate(0, 0, Random.Range(0, 361));
        myReticleObject = GameObject.Instantiate(reticleObject, owner.transform.position, Quaternion.identity);
        reticles        = new List <Reticle>();
        reticle         = myReticleObject.GetComponent <Reticle>();
        reticle.GetComponent <SpriteRenderer>().color = new Color(owner.my_color.r, owner.my_color.g, owner.my_color.b, .5f);

        reticle.cordX = owner.cordX;
        reticle.cordY = owner.cordY;

        owner.aiming = true;
        Vector3 tempPosition;

        tempPosition = new Vector3(owner.transform.position.x, owner.transform.position.y, owner.transform.position.z);

        //move reticle in direction of closest enemy by default
        AutoAim();


        Vector3    vectorToTarget = reticle.transform.position - transform.position;
        float      angle          = (Mathf.Atan2(vectorToTarget.y, vectorToTarget.x) * Mathf.Rad2Deg) + 90;
        Quaternion q = Quaternion.AngleAxis(angle, Vector3.forward);

        transform.rotation = Quaternion.Slerp(transform.rotation, q, 1);
    }
Exemple #11
0
        protected virtual void OnEnable()
        {
            if (string.IsNullOrEmpty(DisplayText))
            {
                SetDefaultDisplayText();
            }

            mHasRequiredPacks = CheckRequiredMotionPacks();

            // If there are no saved preferences for certain prefabs, load the default ones
            if (CombatantHealthBarPrefab == null)
            {
                CombatantHealthBarPrefab = Resources.Load <BasicCombatantHUD>("UI/Combatant HUD");
            }

            if (PlayerHealthBarPrefab == null)
            {
                PlayerHealthBarPrefab = Resources.Load <BasicCombatantHUD>("UI/Player HUD");
            }

            if (ReticlePrefab == null)
            {
                ReticlePrefab = Resources.Load <Reticle>("UI/Reticle");
            }

#if OOTII_CC
            CameraPrefab = Resources.Load <CameraController>("Camera Rig [Advanced]");
#else
            CameraPrefab = Resources.Load <BaseCameraRig>("Camera Rig [Orbit]");
#endif

            InitializeModules();
        }
Exemple #12
0
 void Awake()
 {
     if (m_reticle != null)
     {
         m_reticle = Instantiate(m_reticle, new Vector3(0, 0, 0), Quaternion.identity) as Reticle;
     }
 }
    void Awake()
    {
        HideTarget();

        //find reticle
        reticle = FindObjectOfType <Reticle>();

        //hide by default
        isShowing = false;

        //get the line rend
        if (showArc)
        {
            lineRend = target.GetComponent <LineRenderer>();
            if (lineRend == null)
            {
                Debug.LogError("No line Renderer");
            }
        }

        //set number of points
        lineRend.positionCount = numArcPoints;

        //points vector
        arcPoints = new Vector3[numArcPoints];
    }
 private void createReticles()
 {
     for (int i = 0; i < reticles.Length; i++)
     {
         reticles[i] = new Reticle(reticleHolder, reticleEdgeTilePrefab, reticleAmmoBarTilePrefab);
     }
 }
Exemple #15
0
    void Start()
    {
        controls = FindObjectOfType <PlayerController>().Controls;
        reticle  = GetComponentInChildren <Reticle>();

        controls.Digger.DigAction.performed += HandleDiggerActionPerformed;
    }
Exemple #16
0
        private IEnumerator Start()
        {
            Camera camera = m_camInputsManager.CurrentCamera;

            m_cameraFade = camera.GetComponent <CameraFade>();
            m_camera     = camera.transform;

            m_pathWalker = camera.GetComponentInParent <PathWalker>();


            if (m_camInputsManager.CurrentInputName == "Touch")
            {
                m_selectionRadial = m_touch.GetComponent <SelectionRadial>();
                m_reticle         = m_touch.GetComponent <Reticle>();
            }
            else
            {
                m_selectionRadial = camera.GetComponent <SelectionRadial>();
                m_reticle         = camera.GetComponent <Reticle>();
            }
            SessionData.SetGameType(m_gameType);
            //loop to all phases
            while (true)
            {
                yield return(StartCoroutine(StartPhase()));

                yield return(StartCoroutine(PlayPhase()));

                yield return(StartCoroutine(EndPhase()));
            }
        }
Exemple #17
0
 public void Init()
 {
     Debug.Log("set up in ReticleTest");
     dummy        = new GameObject();
     testObj      = dummy.AddComponent <Reticle>();
     meshrenderer = testObj.gameObject.AddComponent <MeshRenderer>();
     testObj.Start();
 }
Exemple #18
0
 public override void _Ready()
 {
     PlayerDistances  = new Dictionary <Player, float>();
     base._collision  = GetNode <RayCast2D>("Ray_Collision");
     Speed            = 30;
     _reticle         = GetNode <Reticle>("Reticle");
     _reticle.Visible = false;
 }
Exemple #19
0
 private static void OnCreateObj(GameObject obj, EventArgs args)
 {
     if (obj.Name.Contains("Q_reticle_self"))
     {
         var ret = new Reticle(obj, DateTime.Now.Ticks, DateTime.Now.Ticks + 1300);
         Reticles.Add(ret);
     }
 }
Exemple #20
0
    //typeOverride = use to discard what reticle entity is set to,
    // or if there's no entity
    public Reticle Activate(Transform attachTo, Reticle.Type typeOverride = Reticle.Type.NumType)
    {
        Reticle    ret = null;
        EntityBase ent = attachTo.GetComponentInChildren <EntityBase>();

        //verify reticle type
        Reticle.Type reticleType = typeOverride;
        if (ent != null && reticleType == Reticle.Type.NumType)
        {
            reticleType = ent.reticle;
        }

        if (reticleType != Reticle.Type.NumType)
        {
            ret = attachTo.GetComponentInChildren <Reticle>();

            //add a reticle to target
            if (ret == null)
            {
                Transform trans = transform;
                Transform child = null;

                //get or create a reticle
                if (trans.childCount > 0)
                {
                    child = trans.GetChild(0);
                    child.gameObject.SetActiveRecursively(true);
                }
                else
                {
                    child = Transform.Instantiate(template) as Transform;
                }

                //add child to attachee, then switch its layer to target for grabbing
                child.parent = attachTo;
                Transform childTrans = child.transform;
                Vector2   parentPos  = child.parent.position;
                childTrans.position      = new Vector3(parentPos.x, parentPos.y, childZOfs);
                childTrans.localRotation = Quaternion.identity;
                childTrans.localScale    = Vector3.one;

                ret = childTrans.GetComponentInChildren <Reticle>();

                mActiveReticles.Add(new ReticleHolder(ent, ret));
            }

            //set data
            if (ent != null && !ent.FlagsCheck(Entity.Flag.Targetted))
            {
                ent.FlagsAdd(Entity.Flag.Targetted);
                ent.OnTargetted(true);
            }

            ret.Activate(reticleType, ent);
        }

        return(ret);
    }
Exemple #21
0
 // Use this for initialization
 void Start()
 {
     originalRotation = gameObject.transform.localRotation;
     cam        = gameObject.GetComponentInChildren <Camera>();
     guiManager = GameObject.Find("GUIManager");
     reticle    = new Reticle(2, 8);
     reticle.SetColor(color);
     SetMin();
 }
Exemple #22
0
 // Use this for initialization
 void Start()
 {
     reticle              = GameObject.Find("Reticle").GetComponent <Reticle> ();
     name_text.text       = "";
     population_text.text = "";
     agent_orders         = new List <AgentOrder> ();
     agent_orders.Add(new Capture());
     agent_orders.Add(new Burn());
 }
Exemple #23
0
    void Start()
    {
        seated = OpenVR.ChaperoneSetup == null;

        // FIXME Currently no Chaperone / SteamVR support
        seated = true;

        if (VRControls == null)
        {
            VRControls = GameObject.Find("VR Controls");
        }
        if (MainMenuControls == null)
        {
            MainMenuControls = GameObject.Find("Main Menu Controls");
        }
        if (InGameControls == null)
        {
            InGameControls = GameObject.Find("In-Game Controls");
        }
        if (Reticle == null)
        {
            Reticle = GameObject.Find("Reticle").GetComponent <Reticle>();
        }

        // Fix level select height displacement
        if (vr)
        {
            MainMenuControls.transform.localPosition = new Vector3(
                0f,
                0.5f,
                0f
                );
        }

        //InGameControls.transform.parent = Camera.main.transform;
        inGameButtons = new FloatingButton[InGameControls.transform.childCount];
        for (int i = 0; i < inGameButtons.Length; i++)
        {
            Transform childTransform = InGameControls.transform.GetChild(i);

            FloatingButton button = childTransform.GetComponent <FloatingButton>();
            if (button == null)
            {
                continue;
            }
            inGameButtons[i]      = button;
            button.ScaleFadeSpeed = 0f;
        }
        InGameControls.SetActive(false);

        FezUnityNpcInstance.DefaultShouldStartTalking = NPCShouldStartTalking;
        FezUnityNpcInstance.DefaultTalking            = NPCTalking;
        FezUnityNpcInstance.DefaultShouldStopTalking  = NPCShouldStopTalking;

        SwitchLevel(null);
    }
Exemple #24
0
    // Start is called before the first frame update
    void Start()
    {
        gameCanvas.enabled = false;
        scorePanel.SetActive(false);

        inGame = false;

        ret = FindObjectOfType <Reticle>();
        //ret.gameObject.SetActive(false);
    }
        //private float mScreenWidth;

        public void Setup()
        {
            AryzonSettings.Instance.Initialize();
            Reticle reticle = right.GetComponent <Reticle> ();

            if (reticle)
            {
                reticle.m_DefaultDistance = reticle.m_DefaultDistance * sceneUnitsPerMeter;
            }
        }
Exemple #26
0
    //............................................................
    //.................................................. * START *
    void Start()
    {
        GameObject reticleObject = GameObject.FindGameObjectWithTag("Reticle");

        m_ReticleReference = reticleObject.GetComponent <Reticle>();

        m_ReticleRenderer = GetComponent <Renderer>();
        m_ReticleRenderer.sharedMaterial = m_ReticleMaterial;

        m_ReadyFireTimer = m_ReadyFireDur;
    }
Exemple #27
0
 void Start()
 {
     m_gesture_recognizer = new GestureRecognizer();
     m_gesture_recognizer.SetRecognizableGestures(GestureSettings.Tap);
     m_gesture_recognizer.TappedEvent += OnTapEvent;
     m_gesture_recognizer.StartCapturingGestures();
     m_object_layer = 1 << LayerMask.NameToLayer("Default");
     m_reticle      = new Reticle(m_reticle_material);
     SetState(State.Scanning);
     //StartCoroutine(BlinkGazeTargetCoroutine());
 }
 // Start is called before the first frame update
 void Start()
 {
     rb               = GetComponent <Rigidbody>();
     reticle          = canvas.transform.GetChild(0).GetComponent <Reticle>();
     animator         = GetComponent <Animator>();
     gManager         = FindObjectOfType <GManager>();
     reticleTransform = reticle.GetComponent <RectTransform>();
     reticleHeight    = reticleTransform.anchoredPosition.y;
     audioSource      = GetComponent <AudioSource>();
     reticle.Charge(fireDelay * 3);
     nextFire = Time.time + fireDelay * 3;
 }
Exemple #29
0
    //typeOverride = use to discard what reticle entity is set to,
    // or if there's no entity
    public Reticle Activate(Transform attachTo, Reticle.Type typeOverride=Reticle.Type.NumType)
    {
        Reticle ret = null;
        EntityBase ent = attachTo.GetComponentInChildren<EntityBase>();

        //verify reticle type
        Reticle.Type reticleType = typeOverride;
        if(ent != null && reticleType == Reticle.Type.NumType) {
            reticleType = ent.reticle;
        }

        if(reticleType != Reticle.Type.NumType) {
            ret = attachTo.GetComponentInChildren<Reticle>();

            //add a reticle to target
            if(ret == null) {
                Transform trans = transform;
                Transform child = null;

                //get or create a reticle
                if(trans.childCount > 0) {
                    child = trans.GetChild(0);
                    child.gameObject.SetActiveRecursively(true);
                }
                else {
                    child = Transform.Instantiate(template) as Transform;
                }

                //add child to attachee, then switch its layer to target for grabbing
                child.parent = attachTo;
                Transform childTrans = child.transform;
                Vector2 parentPos = child.parent.position;
                childTrans.position = new Vector3(parentPos.x, parentPos.y, childZOfs);
                childTrans.localRotation = Quaternion.identity;
                childTrans.localScale = Vector3.one;

                ret = childTrans.GetComponentInChildren<Reticle>();

                mActiveReticles.Add(new ReticleHolder(ent, ret));
            }

            //set data
            if(ent != null && !ent.FlagsCheck(Entity.Flag.Targetted)) {
                ent.FlagsAdd(Entity.Flag.Targetted);
                ent.OnTargetted(true);
            }

            ret.Activate(reticleType, ent);
        }

        return ret;
    }
    [SerializeField] private float m_RayLength        = 500f;       // How far into the scene the ray is cast.

    private void Awake()
    {
        if (Player == null)
        {
            Player = GetComponent <NetworkPlayer>();
        }

        TargetMarker.rotation = Quaternion.identity;

        m_Reticle = GameObject.FindObjectOfType <Reticle>();

        TargetMarker.transform.SetParent(null);
    }
Exemple #31
0
            public MainGame(WurmsGame parent)
                : base(parent)
            {
                this._objects = new Dictionary<string, GameObject>();
                this._reticle = new Reticle(this._parent.Content.Load<Texture2D>("CrossHair"), this._parent._spriteBatch, new Vector2(0.0f, 0.0f));

                this._objects["water"] = new Water(this._parent, this._parent.Content.Load<Texture2D>("Water"), new Vector2(0.0f, 300.0f));
                this._objects["terrain"] = new Terrain(this._parent, this._parent.Content.Load<Texture2D>("FirstLand"), new Vector2(0.0f, 0.0f));
                this._objects["player_one"] = new Player(this._parent, this._parent.Content.Load<Texture2D>("RedPlayerWithShotgun"), new Vector2(240.0f, 100.0f));

                this._activePlayer = (Player)this._objects["player_one"];
                this._collisionMan = new CollisionManager(ref this._objects, ref this._reticle);
            }
Exemple #32
0
    public void ActivateInRange(Vector3 pos, float radius, int layerMask, Reticle.Type typeOverride=Reticle.Type.NumType)
    {
        //TODO: optimize
        DeactivateAll();

        RaycastHit[] hits = Physics.SphereCastAll(pos, radius, new Vector3(0,0,1.0f), Mathf.Infinity, layerMask);
        if(hits.Length > 0) {
            foreach(RaycastHit hit in hits) {
                Transform t = hit.transform;
                Activate(t, typeOverride);
            }
        }
    }
Exemple #33
0
        private void ConnectObjects()
        {
            if (!objectsConnected)
            {
                Transform uiOverlayTransform   = transform.Find("UI Overlay");
                Transform portraitUITransform  = transform.Find("UI Overlay/Portrait");
                Transform landscapeUITransform = transform.Find("UI Overlay/Landscape");

                stereoscopic = transform.Find("Stereoscopic");
                Transform camerasTransform     = transform.Find("Stereoscopic/Cameras");
                Transform cameraLeftTransform  = transform.Find("Stereoscopic/Cameras/Left");
                Transform cameraRightTransform = transform.Find("Stereoscopic/Cameras/Right");

                Transform reticleTransform = transform.Find("Stereoscopic/Cameras/Right/Reticle/Dot");

                if (uiOverlayTransform)
                {
                    uiOverlay = uiOverlayTransform.gameObject;
                }
                if (portraitUITransform)
                {
                    portraitUI = portraitUITransform.gameObject;
                }
                if (landscapeUITransform)
                {
                    landscapeUI = landscapeUITransform.gameObject;
                }
                if (camerasTransform)
                {
                    cameras = camerasTransform.gameObject;
                }
                if (cameraLeftTransform)
                {
                    cameraLeft = cameraLeftTransform.gameObject.GetComponent <Camera> ();
                }
                if (cameraRightTransform)
                {
                    cameraRight = cameraRightTransform.gameObject.GetComponent <Camera> ();
                }

                reticle            = cameraRightTransform.gameObject.GetComponentInChildren <Reticle> ();
                reticleFader       = reticleTransform.gameObject.GetComponent <FadeOnEnableAndDisable>();
                aryzonUIController = portraitUITransform.gameObject.GetComponentInChildren <AryzonUIController>();

                reticleEnabled = false;

                objectsConnected = true;
            }
        }
Exemple #34
0
 public ScanningView(RectangleF frame)
     : base(frame)
 {
     if (App.Inst.IsIPad) {
         BGW = 1024;
     } else {
         BGW = 1024;
     }
     _bg = new ScanningView.BG (new RectangleF (-BGW, -BGW, 2 * BGW, 2 * BGW));
     AddSubview (_bg);
     var rw = Math.Min (frame.Width, frame.Height) / 2;
     _ret = new ScanningView.Reticle (new RectangleF ((float)(_rand.NextDouble () - 0.5) * frame.Width * 2, (float)(_rand.NextDouble () - 0.5) * frame.Height * 2, rw, rw));
     _ret.Alpha = 0.7f;
     ClipsToBounds = true;
     Layer.CornerRadius = 20;
     AddSubview (_ret);
 }
Exemple #35
0
            Button _playBtn; //"Play Button"

            #endregion Fields

            #region Constructors

            public Title(WurmsGame parent)
                : base(parent)
            {
                this._background = new Sprite(  this._parent.Content.Load<Texture2D>("TitleScreen"),
                                                this._parent._spriteBatch,
                                                new Vector2(0.0f, 0.0f));

                this._playBtn = new Button( this._parent.Content.Load<Texture2D>("PlayButton"),
                                             this._parent._spriteBatch,
                                            new Vector2(270.0f, 290.0f),
                                            this._mouseState,
                                            new Callback(this.PlayCallback));

                this._exitBtn = new Button( this._parent.Content.Load<Texture2D>("ExitButton"),
                                            this._parent._spriteBatch,
                                            new Vector2(270, 360.0f),
                                            this._mouseState,
                                            new Callback(this.ExitCallback));

                this._cursor = new Reticle( this._parent.Content.Load<Texture2D>("CrossHair"),
                                            this._parent._spriteBatch,
                                            new Vector2(0.0f, 0.0f));
            }
Exemple #36
0
 public void SetReticle(Reticle reticle)
 {
     reticle_ = reticle;
 }
 public CollisionManager(ref Dictionary<string, GameObject> objects, ref Reticle reticle)
 {
     this._objects = objects;
     this._reticle = reticle;
 }
 // Use this for initialization
 void Start()
 {
     gameScript = gameData.GetComponent<Reticle>();
 }
    void RefreshReticles()
    {
        Vector2 mouse = Util.MouseToScreen();

        Vector2 headPos = head.position;

        Vector2 dir = mouse - headPos;
        float len = dir.magnitude;
        dir /= len;

        if(len > radius) {
            len = radius;
        }

        //Main.instance.reticleManager.ActivateInRange(head.position, radius, mLayerMasksGrab);

        RaycastHit hit;
        if(Physics.Raycast(headPos, dir, out hit, len, mLayerMasksGrab)) {
            if(mReticleCheck == null || hit.transform != mReticleCheck.transform.parent) {
                Main.instance.reticleManager.DeactivateAll();
                mReticleCheck = Main.instance.reticleManager.Activate(hit.transform);
            }
            else if(mReticleCheck.entity == null || mReticleCheck.entity.reticle == Reticle.Type.NumType) {
                Main.instance.reticleManager.DeactivateAll();
                mReticleCheck = null;
            }
        }
        else {
            Main.instance.reticleManager.DeactivateAll();
            mReticleCheck=null;
        }
    }
Exemple #40
0
 public ReticleHolder(EntityBase target, Reticle r)
 {
     targettedEntity = target;
     reticle = r;
 }