Пример #1
0
    protected override void Dispose(bool disposing)
    {
        base.Dispose(disposing);

        Object.Destroy(debugArrow);
        debugArrow = null;
    }
Пример #2
0
	public void OnBeginDrag (PointerEventData eventData)
	{
		if(!cardData.hasTag(player1["activeTag"] as string)&&
       !cardData.hasTag(player1["dismissableTag"] as string)) return;

		GameObject go=Instantiate(arrow) as GameObject;
		ArrowPointer pnt=go.GetComponent<ArrowPointer>();
		RectTransform rt=go.GetComponent<RectTransform>();
		RectTransform self=transform as RectTransform;
		rt.SetParent(self.RootCanvasTransform(),false);
		rt.SetAsLastSibling();
		from=pnt;
		frompoint=self.getPivotInCanvas();
		Debug.Log(player1["TARGETED"]);
		if(player1["TARGETED"]==cardData)
		{
			//Debug.Log("highlight");
		player1.setTag("EMITTER_HIGHLIGHTED");
		}
		else
		{
			lock(SingleGame.gameLock)
			{
				SingleGame.GameManager.self._GameData["Player1.SELECTED"]=data;//card.cardData;
			//	Debug.Log(player1["SELECTED"]);
			}
		}
	}
Пример #3
0
        void LateUpdate()
        {
            if (arrowTransform == null)
            {
                if (velocityArrow != null)
                {
                    UnityEngine.Object.Destroy(velocityArrow);
                }

                if (EditorLogic.RootPart != null)
                {
                    arrowTransform = EditorLogic.RootPart.partTransform;
                }
                else
                {
                    return;
                }
            }
            if (velocityArrow == null)
            {
                velocityArrow = ArrowPointer.Create(arrowTransform, Vector3.zero, Vector3.forward, 15, Color.white, true);
            }

            if (showGUI && showAoAArrow)
            {
                velocityArrow.gameObject.SetActive(true);
                ArrowDisplay();
            }
            else
            {
                velocityArrow.gameObject.SetActive(false);
            }
        }
Пример #4
0
 public void drawArrow(Vector3 dir, Transform t)
 {
     if (pointer == null)
         pointer = ArrowPointer.Create(t, Vector3.zero, dir, 100, Color.red, true);
     else
         pointer.Direction = dir;
 }
Пример #5
0
 public void OnEndDrag(PointerEventData eventData)
 {
     if(pnt!=null)
     {
     Destroy(pnt.gameObject);
     pnt=null;
     }
 }
Пример #6
0
 private void Awake()
 {
     if (s_myInstance == null)
     {
         s_myInstance = this;
     }
     else
     {
         Destroy(this);
     }
 }
Пример #7
0
    /// <summary>
    /// Start is called on the frame when a script is enabled just before
    /// any of the Update methods is called the first time.
    /// </summary>
    void Start()
    {
        //instantiate OffScreen pointer
        pointer = (GameObject)Instantiate(PointerPrefab, transform.position, Quaternion.identity);
        ArrowPointer pointerScript = pointer.GetComponent <ArrowPointer>();

        pointerScript.targetTransform = transform;
        pointer.transform.parent      = GameObject.FindGameObjectWithTag("Pointers").transform;
        pointer.transform.localScale  = new Vector3(1, 1, 1);
        rigidbody2D = GetComponent <Rigidbody2D>();
    }
Пример #8
0
 public void DrawArrow(Vector3 dir, Transform t)
 {
     if (ReferenceEquals(pointer, null))
     {
         pointer = ArrowPointer.Create(t, Vector3.zero, dir, 100, Color.red, true);
     }
     else
     {
         pointer.Direction = dir;
     }
 }
Пример #9
0
 public void drawArrow(Vector3 dir, Transform t)
 {
     if (pointer == null)
     {
         pointer = ArrowPointer.Create(t, Vector3.zero, dir, 100, Color.red, true);
     }
     else
     {
         pointer.Direction = dir;
     }
 }
 // Use this for initialization
 void Start()
 {
     gameStore = FindObjectOfType <Store>();
     outline   = GetComponent <OutlineComponent>();
     outline.Enable();
     outline.setParticles(false);
     dragging   = true;
     pointer    = GetComponentInChildren <ArrowPointer>();
     placement  = GetComponent <Placeable>();
     selectable = GetComponent <Selectable>();
 }
Пример #11
0
    public void OnBeginDrag(PointerEventData eventData)
    {
        GameObject go=Instantiate(arr) as GameObject;
        pnt=go.GetComponent<ArrowPointer>();
        RectTransform rt=go.GetComponent<RectTransform>();
        RectTransform self=transform as RectTransform;
        rt.SetParent(self.RootCanvasTransform(),false);
        rt.SetAsLastSibling();

        cnv=rt.RootCanvasTransform();
        RectTransformUtility.ScreenPointToLocalPointInRectangle(cnv, eventData.position,eventData.pressEventCamera,out initpos);
    }
Пример #12
0
    void Start()
    {
        rb            = GetComponent <Rigidbody>();
        wpc           = GameObject.FindObjectOfType <WaypointCollection>();
        pinSet        = GameObject.FindObjectOfType <PinSet>();
        startPosition = GameObject.FindObjectOfType <StartPosition>();

        bounds = GetComponent <SphereCollider>().bounds;

        arrowPointer        = GetComponentInChildren <ArrowPointer>();
        arrowOriginRotation = arrowPointer.transform.rotation;
        arrowPointer.gameObject.SetActive(false);
    }
        public void ArrowAnim(ArrowPointer velArrow)
        {
            velArrow.Direction = pingPongAoAFactor < 1
                                     ? Vector3.Slerp(lowerAoAVec, upperAoAVec, pingPongAoAFactor)
                                     : Vector3.Slerp(lowerAoAVec, upperAoAVec, 2 - pingPongAoAFactor);

            pingPongAoAFactor += TimeWarp.deltaTime * 0.5f;

            if (pingPongAoAFactor >= 2)
            {
                pingPongAoAFactor = 0;
            }
        }
Пример #14
0
    public void OnBeginDrag(PointerEventData eventData)
    {
        GameObject go = Instantiate(arr) as GameObject;

        pnt = go.GetComponent <ArrowPointer>();
        RectTransform rt   = go.GetComponent <RectTransform>();
        RectTransform self = transform as RectTransform;

        rt.SetParent(self.RootCanvasTransform(), false);
        rt.SetAsLastSibling();

        cnv = rt.RootCanvasTransform();
        RectTransformUtility.ScreenPointToLocalPointInRectangle(cnv, eventData.position, eventData.pressEventCamera, out initpos);
    }
Пример #15
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ModifyDataWindow"/> class.
        ///   Initializes a new instance of the <see cref="ManualDataAquisitionWindow"/> class.
        /// </summary>
        public ModifyDataWindow()
        {
            this.InitializeComponent();

            this.ObjectIndexPanel.DataContext = this;
            this.WindowCanvas.DataContext     = this;

            var arrowCount = Viana.Project.ProcessingData.NumberOfTrackedObjects;

            this.isDraggingCursor = new bool[arrowCount];
            this.arrowPointers    = new ArrowPointer[arrowCount];
            for (int i = 0; i < arrowCount; i++)
            {
                var pointer = new ArrowPointer();
                pointer.Name                 = "Object" + (i + 1).ToString(CultureInfo.InvariantCulture);
                pointer.Stroke               = new SolidColorBrush(Viana.Project.ProcessingData.TargetColor[i]);
                pointer.Fill                 = Brushes.Transparent;
                pointer.Length               = 50;
                pointer.CenterSpace          = 5;
                pointer.HeadHeight           = 6;
                pointer.HeadWidth            = 15;
                pointer.Cursor               = Cursors.Hand;
                pointer.MouseLeftButtonDown += this.ArrowShapeMouseLeftButtonDown;
                pointer.MouseMove           += this.CursorEllipse_OnMouseMove;
                pointer.MouseLeftButtonUp   += this.CursorEllipse_OnMouseLeftButtonUp;
                this.arrowPointers[i]        = pointer;
                this.WindowCanvas.Children.Add(pointer);
            }

            this.SetVisibilityOfArrowCursor(true);

            this.CursorEllipse.Width  = 2 * this.visualDataPointRadius;
            this.CursorEllipse.Height = 2 * this.visualDataPointRadius;

            this.timesliderUpdateTimer = new DispatcherTimer {
                Interval = TimeSpan.FromMilliseconds(200)
            };
            this.timesliderUpdateTimer.Tick += this.TimesliderUpdateTimerTick;

            if (Video.Instance.VideoMode == VideoMode.Capture)
            {
                this.FramePanel.Visibility     = Visibility.Hidden;
                this.TimelineSlider.Visibility = Visibility.Hidden;
            }

            this.SetVisibilityOfSharpCursor(false);
        }
Пример #16
0
	void IEndDragHandler.OnEndDrag (PointerEventData eventData)
	{
	 if(from!=null)
		{
			Destroy(from.gameObject);
			from=null;
		}
		player1.removeTag("EMITTER_HIGHLIGHTED");
		if(to!=null)
		{
			Destroy(to.gameObject);
			to=null;
		}

		waitingForDrop=true;

	}
 private void OnDestroy()
 {
     if (liftArrow != null)
     {
         UnityEngine.Object.Destroy(liftArrow);
         liftArrow = null;
     }
     if (dragArrow != null)
     {
         UnityEngine.Object.Destroy(dragArrow);
         dragArrow = null;
     }
     if (momentArrow != null)
     {
         UnityEngine.Object.Destroy(momentArrow);
         momentArrow = null;
     }
     legacyWingModel        = null;
     stockAeroSurfaceModule = null;
 }
        public void ArrowAnim(ArrowPointer velArrow)
        {
            if (pingPongAoAFactor < 1)
            {
                velArrow.Direction = Vector3.Slerp(lowerAoAVec, upperAoAVec, pingPongAoAFactor);
            }
            else
            {
                velArrow.Direction = Vector3.Slerp(lowerAoAVec, upperAoAVec, 2 - pingPongAoAFactor);
            }

            pingPongAoAFactor += TimeWarp.deltaTime * 0.5f;

            if (pingPongAoAFactor >= 2)
            {
                pingPongAoAFactor = 0;
            }

            //FARLogger.Info("" + velArrow.Direction);
        }
Пример #19
0
        private void OnDestroy()
        {
            if (liftArrow != null)
            {
                Destroy(liftArrow);
                liftArrow = null;
            }

            if (dragArrow != null)
            {
                Destroy(dragArrow);
                dragArrow = null;
            }

            if (momentArrow != null)
            {
                Destroy(momentArrow);
                momentArrow = null;
            }

            LegacyWingModel        = null;
            stockAeroSurfaceModule = null;
        }
Пример #20
0
 public ExposureDebugger(Transform parent = null)
 {
     debugArrow = ArrowPointer.Create(parent, Vector3.zero, Vector3.forward, 10f, Color.red, false);
 }
        private void UpdateAeroDisplay()
        {
            Vector3 worldDragArrow = Vector3.zero;
            Vector3 worldLiftArrow = Vector3.zero;

            if (PhysicsGlobals.AeroForceDisplay || PhysicsGlobals.AeroDataDisplay)
            {
                Vector3 worldVelNorm = partTransform.localToWorldMatrix.MultiplyVector(partLocalVelNorm);
                worldDragArrow = Vector3.Dot(worldSpaceAeroForce, worldVelNorm) * worldVelNorm;
                worldLiftArrow = worldSpaceAeroForce - worldDragArrow;
            }
            if (PhysicsGlobals.AeroForceDisplay)
            {
                if (liftArrow == null)
                    liftArrow = ArrowPointer.Create(partTransform, Vector3.zero, worldLiftArrow, worldLiftArrow.magnitude * PhysicsGlobals.AeroForceDisplayScale, FARGUI.GUIColors.GetColor(0), true);
                else
                {
                    liftArrow.Direction = worldLiftArrow;
                    liftArrow.Length = worldLiftArrow.magnitude * PhysicsGlobals.AeroForceDisplayScale;
                }

                if (dragArrow == null)
                    dragArrow = ArrowPointer.Create(partTransform, Vector3.zero, worldDragArrow, worldDragArrow.magnitude * PhysicsGlobals.AeroForceDisplayScale, FARGUI.GUIColors.GetColor(1), true);
                else
                {
                    dragArrow.Direction = worldDragArrow;
                    dragArrow.Length = worldDragArrow.magnitude * PhysicsGlobals.AeroForceDisplayScale;
                }

                if (FARDebugValues.showMomentArrows)
                {
                    if (momentArrow == null)
                        momentArrow = ArrowPointer.Create(partTransform, Vector3.zero, worldSpaceTorque, worldSpaceTorque.magnitude * PhysicsGlobals.AeroForceDisplayScale, FARGUI.GUIColors.GetColor(2), true);
                    else
                    {
                        momentArrow.Direction = -worldSpaceTorque;
                        momentArrow.Length = worldSpaceTorque.magnitude * PhysicsGlobals.AeroForceDisplayScale;
                    }
                }
            }
            else
            {
                if ((object)liftArrow != null)
                {
                    UnityEngine.Object.Destroy(liftArrow);
                    liftArrow = null;
                }
                if ((object)dragArrow != null)
                {
                    UnityEngine.Object.Destroy(dragArrow);
                    dragArrow = null;
                }
                if ((object)momentArrow != null)
                {
                    UnityEngine.Object.Destroy(momentArrow);
                    momentArrow = null;
                }
            }

            if (PhysicsGlobals.AeroDataDisplay)
            {
                if (!fieldsVisible)
                {
                    Fields["dragForce"].guiActive = true;
                    Fields["liftForce"].guiActive = true;
                    fieldsVisible = true;
                }

                dragForce = worldDragArrow.magnitude;
                liftForce = worldLiftArrow.magnitude;

            }
            else if (fieldsVisible)
            {
                Fields["dragForce"].guiActive = false;
                Fields["liftForce"].guiActive = false;
                fieldsVisible = false;
            }
        }
Пример #22
0
 void destroyArrow()
 {
     if (pointer != null)
     {
         Destroy(pointer);
         pointer = null;
     }
 }
Пример #23
0
        private void UpdateAeroDisplay()
        {
            Vector3 worldDragArrow = Vector3.zero;
            Vector3 worldLiftArrow = Vector3.zero;

            if ((PhysicsGlobals.AeroForceDisplay || PhysicsGlobals.AeroDataDisplay) && !part.ShieldedFromAirstream)
            {
                Vector3 worldVelNorm = partTransform.localToWorldMatrix.MultiplyVector(partLocalVelNorm);
                worldDragArrow = Vector3.Dot(worldSpaceAeroForce, worldVelNorm) * worldVelNorm;
                worldLiftArrow = worldSpaceAeroForce - worldDragArrow;
            }

            if (PhysicsGlobals.AeroForceDisplay && !part.ShieldedFromAirstream)
            {
                if (liftArrow == null)
                {
                    liftArrow = ArrowPointer.Create(partTransform,
                                                    Vector3.zero,
                                                    worldLiftArrow,
                                                    worldLiftArrow.magnitude *
                                                    FARKSPAddonFlightScene.FARAeroForceDisplayScale,
                                                    GUIColors.GetColor(0),
                                                    true);
                }
                else
                {
                    liftArrow.Direction = worldLiftArrow;
                    liftArrow.Length    = worldLiftArrow.magnitude * FARKSPAddonFlightScene.FARAeroForceDisplayScale;
                }

                if (dragArrow == null)
                {
                    dragArrow = ArrowPointer.Create(partTransform,
                                                    Vector3.zero,
                                                    worldDragArrow,
                                                    worldDragArrow.magnitude *
                                                    FARKSPAddonFlightScene.FARAeroForceDisplayScale,
                                                    GUIColors.GetColor(1),
                                                    true);
                }
                else
                {
                    dragArrow.Direction = worldDragArrow;
                    dragArrow.Length    = worldDragArrow.magnitude * FARKSPAddonFlightScene.FARAeroForceDisplayScale;
                }

                if (FARDebugValues.showMomentArrows)
                {
                    if (momentArrow == null)
                    {
                        momentArrow = ArrowPointer.Create(partTransform,
                                                          Vector3.zero,
                                                          worldSpaceTorque,
                                                          worldSpaceTorque.magnitude *
                                                          FARKSPAddonFlightScene.FARAeroForceDisplayScale,
                                                          GUIColors.GetColor(2),
                                                          true);
                    }
                    else
                    {
                        momentArrow.Direction = -worldSpaceTorque;
                        momentArrow.Length    =
                            worldSpaceTorque.magnitude * FARKSPAddonFlightScene.FARAeroForceDisplayScale;
                    }
                }
            }
            else
            {
                if (!(liftArrow is null))
                {
                    Destroy(liftArrow);
                    liftArrow = null;
                }

                if (!(dragArrow is null))
                {
                    Destroy(dragArrow);
                    dragArrow = null;
                }

                if (!(momentArrow is null))
                {
                    Destroy(momentArrow);
                    momentArrow = null;
                }
            }

            if (PhysicsGlobals.AeroDataDisplay && !part.ShieldedFromAirstream)
            {
                if (!fieldsVisible)
                {
                    Fields["dragForce"].guiActive = true;
                    Fields["liftForce"].guiActive = true;
                    fieldsVisible = true;
                }

                dragForce = worldDragArrow.magnitude;
                liftForce = worldLiftArrow.magnitude;
            }
            else if (fieldsVisible)
            {
                Fields["dragForce"].guiActive = false;
                Fields["liftForce"].guiActive = false;
                fieldsVisible = false;
            }
        }
 public void ArrowAnim(ArrowPointer velArrow)
 {
     velArrow.Direction = -aoAVec;
 }
Пример #25
0
    void IEndDragHandler.OnEndDrag(PointerEventData eventData)
    {
        if(from!=null)
        {
            Destroy(from.gameObject);
            from=null;
        }
        player1.removeTag("EMITTER_HIGHLIGHTED");
        if(to!=null)
        {
            Destroy(to.gameObject);
            to=null;
        }

        waitingForDrop=true;
    }
Пример #26
0
    public void OnBeginDrag(PointerEventData eventData)
    {
        if(!cardData.hasTag(player1["activeTag"] as string)&&
           !cardData.hasTag(player1["dismissableTag"] as string)) return;

        GameObject go=Instantiate(arrow) as GameObject;
        ArrowPointer pnt=go.GetComponent<ArrowPointer>();
        RectTransform rt=go.GetComponent<RectTransform>();
        RectTransform self=transform as RectTransform;
        rt.SetParent(self.RootCanvasTransform(),false);
        rt.SetAsLastSibling();
        from=pnt;
        frompoint=self.getPivotInCanvas();
        Debug.Log(player1["TARGETED"]);
        if(player1["TARGETED"]==cardData)
        {
            //Debug.Log("highlight");
        player1.setTag("EMITTER_HIGHLIGHTED");
        }
        else
        {
            lock(SingleGame.gameLock)
            {
                SingleGame.GameManager.self._GameData["Player1.SELECTED"]=data;//card.cardData;
            //	Debug.Log(player1["SELECTED"]);
            }
        }
    }
Пример #27
0
    void IDropHandler.OnDrop(PointerEventData eventData)
    {
        if(eventData.pointerDrag!=null)
        {

            CardControl card=eventData.pointerDrag.GetComponent<CardControl>();
            if(card!=null)
            {
                if(data!=null&&data.hasTag(data["|-.Player1.targetTag"] as string))
        {
          lock(SingleGame.gameLock)
          {
            SingleGame.GameManager.self._GameData["Player1.TARGETED"]=data;//card.cardData;
                        //Debug.Log(player1["TARGETED"]);
          }
                //Debug.Log(card);
                /*RectTransform cardrt=card.gameObject.GetComponent<RectTransform>();
                cardrt.SetParent(gameObject.transform,false);
                cardrt.anchorMin=Vector2.zero;
                cardrt.anchorMax=Vector2.one;
                cardrt.offsetMax=Vector2.zero;
                cardrt.offsetMin=Vector2.zero;
                cardrt.localScale=new Vector3(1,1,1);*/
                if(!card.cardData.hasTag("ABILITY"))
                 card.registerDropSuccess(false);
                    else
                    {
                        Debug.Log("ssss");
                        Vector2 ops= card.getOPos();
                        RectTransform ctp=card.gameObject.GetComponent<RectTransform>();
                        Vector2 sv=ctp.anchoredPosition;
                        ctp.anchoredPosition=ops;
                        ops=ctp.getPivotInCanvas();
                        ctp.anchoredPosition=sv;
                        Vector2 dest=(transform as RectTransform).getPivotInCanvas();
                        GameObject go=Instantiate(arrow) as GameObject;
                        ArrowPointer pnt=go.GetComponent<ArrowPointer>();
                        RectTransform rt=go.GetComponent<RectTransform>();
                        RectTransform self=transform as RectTransform;
                        rt.SetParent(self.RootCanvasTransform(),false);
                        rt.SetAsLastSibling();
                        Debug.Log(ops);
                        pnt.drawArrow(ops,dest);
                        to=pnt;
                        card.registerDropSuccess(false);
                    }
        }
        else
         card.registerDropSuccess(false);
            }
            else
            {
                CardReceptor rc=eventData.pointerDrag.GetComponent<CardReceptor>();
        if(cardData.hasTag("DISMISS_AREA")&&rc!=null&&
           rc.cardData.hasTag(player1["dismissableTag"] as string))
        {
          rc.cardData.setTag("DESELECT");
          rc.cardData.setTag("DISMISS_MARK");
          return;
        }
                if(rc!=null&&cardData.hasTag(player1["aimTag"] as string))
                { // this is ability resolution
                    player1["AIMED"]=cardData;
                    Debug.Log(rc);
                    rc.DropOccurred();
                    return;
                }

                if(rc!=null&&cardData.hasTag(player1["targetTag"] as string))
                   {
                    player1["TARGETED"]=cardData;
                    Debug.Log(rc);
                    rc.DropOccurred();
               return;
                }

            }
        }
    }
        void LateUpdate()
        {
            if (arrowTransform == null)
            {
                if (velocityArrow != null)
                    UnityEngine.Object.Destroy(velocityArrow);

                if (EditorLogic.RootPart != null)
                    arrowTransform = EditorLogic.RootPart.partTransform;
                else
                    return;
            }
            if (velocityArrow == null)
                velocityArrow = ArrowPointer.Create(arrowTransform, Vector3.zero, Vector3.forward, 15, Color.white, true);

            if (showGUI && showAoAArrow)
            {
                velocityArrow.gameObject.SetActive(true);
                ArrowDisplay();
            }
            else
                velocityArrow.gameObject.SetActive(false);
        }
 public void ArrowAnim(ArrowPointer velArrow)
 {
     velArrow.Direction = -aoAVec;
     //FARLogger.Info("" + velArrow.Direction);
 }
Пример #30
0
 public void destroyArrow()
 {
     UnityEngine.Object.Destroy(pointer);
     pointer = null;
 }
        public void ArrowAnim(ArrowPointer velArrow)
        {
            if (pingPongAoAFactor < 1)
                velArrow.Direction = Vector3.Slerp(lowerAoAVec, upperAoAVec, pingPongAoAFactor);
            else
                velArrow.Direction = Vector3.Slerp(lowerAoAVec, upperAoAVec, 2 - pingPongAoAFactor);

            pingPongAoAFactor += TimeWarp.deltaTime * 0.5f;

            if (pingPongAoAFactor >= 2)
                pingPongAoAFactor = 0;

            //Debug.Log(velArrow.Direction);
        }
 public void ArrowAnim(ArrowPointer velArrow)
 {
     velArrow.Direction = -aoAVec;
     //Debug.Log(velArrow.Direction);
 }
Пример #33
0
        public void SetProjectedArea(ProjectedArea areas, Matrix4x4 vesselToWorldMatrix)
        {
            var transformedArea = new ProjectedArea();

            if (!part)
            {
                return;
            }

            Matrix4x4 transformMatrix = part.partTransform.worldToLocalMatrix * vesselToWorldMatrix;

            IncrementAreas(ref transformedArea, (float)areas.iP * Vector3.right, transformMatrix);
            IncrementAreas(ref transformedArea, (float)areas.iN * -Vector3.right, transformMatrix);
            IncrementAreas(ref transformedArea, (float)areas.jP * Vector3.up, transformMatrix);
            IncrementAreas(ref transformedArea, (float)areas.jN * -Vector3.up, transformMatrix);
            IncrementAreas(ref transformedArea, (float)areas.kP * Vector3.forward, transformMatrix);
            IncrementAreas(ref transformedArea, (float)areas.kN * -Vector3.forward, transformMatrix);

            projectedArea           = transformedArea;
            projectedArea.totalArea = projectedArea.iN +
                                      projectedArea.iP +
                                      projectedArea.jN +
                                      projectedArea.jP +
                                      projectedArea.kN +
                                      projectedArea.kP;

            if (projectedArea.totalArea <= 0)
            {
                part.ShieldedFromAirstream = true;
                if (fieldsVisible)
                {
                    Fields["dragForce"].guiActive = false;
                    Fields["liftForce"].guiActive = false;
                    fieldsVisible = false;
                }

                if (!(liftArrow is null))
                {
                    Destroy(liftArrow);
                    liftArrow = null;
                }

                if (!(dragArrow is null))
                {
                    Destroy(dragArrow);
                    dragArrow = null;
                }

                if (!(momentArrow is null))
                {
                    Destroy(momentArrow);
                    momentArrow = null;
                }
            }
            else
            {
                part.ShieldedFromAirstream = false;
            }

            double areaForStress = projectedArea.totalArea / 6;

            if (!FARDebugValues.allowStructuralFailures ||
                areaForStress <= 0.1 ||
                part.Modules.Contains <RealChuteFAR>() ||
                part.Modules.Contains <ModuleAblator>())
            {
                partForceMaxY  = double.MaxValue;
                partForceMaxXZ = double.MaxValue;
                return;
            }

            partForceMaxY  = areaForStress * partStressMaxY;
            partForceMaxXZ = areaForStress * partStressMaxXZ;
        }
        public void ArrowAnim(ArrowPointer velArrow)
        {
            velArrow.Direction = aoAVec;

            //Debug.Log(velArrow.Direction);
        }
        public void SetProjectedArea(ProjectedArea areas, Matrix4x4 vesselToWorldMatrix)
        {
            ProjectedArea transformedArea = new ProjectedArea();
            if (!part)
                return;

            Matrix4x4 transformMatrix = part.partTransform.worldToLocalMatrix * vesselToWorldMatrix;

            IncrementAreas(ref transformedArea, (float)areas.iP * Vector3.right, transformMatrix);
            IncrementAreas(ref transformedArea, (float)areas.iN * -Vector3.right, transformMatrix);
            IncrementAreas(ref transformedArea, (float)areas.jP * Vector3.up, transformMatrix);
            IncrementAreas(ref transformedArea, (float)areas.jN * -Vector3.up, transformMatrix);
            IncrementAreas(ref transformedArea, (float)areas.kP * Vector3.forward, transformMatrix);
            IncrementAreas(ref transformedArea, (float)areas.kN * -Vector3.forward, transformMatrix);

            projectedArea = transformedArea;
            projectedArea.totalArea = projectedArea.iN + projectedArea.iP + projectedArea.jN + projectedArea.jP + projectedArea.kN + projectedArea.kP;

            if (projectedArea.totalArea <= 0)
            {
                part.ShieldedFromAirstream = true;
                if (fieldsVisible)
                {
                    Fields["dragForce"].guiActive = false;
                    Fields["liftForce"].guiActive = false;
                    fieldsVisible = false;
                }
                if ((object)liftArrow != null)
                {
                    UnityEngine.Object.Destroy(liftArrow);
                    liftArrow = null;
                }
                if ((object)dragArrow != null)
                {
                    UnityEngine.Object.Destroy(dragArrow);
                    dragArrow = null;
                }
                if ((object)momentArrow != null)
                {
                    UnityEngine.Object.Destroy(momentArrow);
                    momentArrow = null;
                }
            }
            else
            {
                part.ShieldedFromAirstream = false;
            }

            double areaForStress = projectedArea.totalArea / 6;
            if (areaForStress <= 0.1 || part.Modules.Contains("RealChuteFAR") || part.Modules.Contains("ModuleAblator"))
            {
                partForceMaxY = double.MaxValue;
                partForceMaxXZ = double.MaxValue;
                return;
            }
            partForceMaxY = areaForStress * partStressMaxY;
            partForceMaxXZ = areaForStress * partStressMaxXZ;
        }
 private void OnDestroy()
 {
     if (liftArrow != null)
     {
         UnityEngine.Object.Destroy(liftArrow);
         liftArrow = null;
     }
     if (dragArrow != null)
     {
         UnityEngine.Object.Destroy(dragArrow);
         dragArrow = null;
     }
     if (momentArrow != null)
     {
         UnityEngine.Object.Destroy(momentArrow);
         momentArrow = null;
     }
     legacyWingModel = null;
     stockAeroSurfaceModule = null;
 }
Пример #37
0
 void DrawArrow(Vector3 dir)
 {
     if (pointer == null)
         pointer = ArrowPointer.Create(part.partTransform, Vector3.zero, dir, 30, Color.red, true);
     else
         pointer.Direction = dir;
 }
Пример #38
0
	void IDropHandler.OnDrop (PointerEventData eventData)
	{
		if(eventData.pointerDrag!=null)
		{

			CardControl card=eventData.pointerDrag.GetComponent<CardControl>();
			if(card!=null)
			{
				if(data!=null&&data.hasTag(data["|-.Player1.targetTag"] as string))
        {
          lock(SingleGame.gameLock)
          {
            SingleGame.GameManager.self._GameData["Player1.TARGETED"]=data;//card.cardData;
						//Debug.Log(player1["TARGETED"]);
          }
				//Debug.Log(card);
				/*RectTransform cardrt=card.gameObject.GetComponent<RectTransform>();
				cardrt.SetParent(gameObject.transform,false);
				cardrt.anchorMin=Vector2.zero;
				cardrt.anchorMax=Vector2.one;
				cardrt.offsetMax=Vector2.zero;
				cardrt.offsetMin=Vector2.zero;
				cardrt.localScale=new Vector3(1,1,1);*/
				if(!card.cardData.hasTag("ABILITY"))
				 card.registerDropSuccess(false);
					else
					{
						Debug.Log("ssss");
						Vector2 ops= card.getOPos();
						RectTransform ctp=card.gameObject.GetComponent<RectTransform>();
						Vector2 sv=ctp.anchoredPosition;
						ctp.anchoredPosition=ops;
						ops=ctp.getPivotInCanvas();
						ctp.anchoredPosition=sv;
						Vector2 dest=(transform as RectTransform).getPivotInCanvas();
						GameObject go=Instantiate(arrow) as GameObject;
						ArrowPointer pnt=go.GetComponent<ArrowPointer>();
						RectTransform rt=go.GetComponent<RectTransform>();
						RectTransform self=transform as RectTransform;
						rt.SetParent(self.RootCanvasTransform(),false);
						rt.SetAsLastSibling();
						Debug.Log(ops);
						pnt.drawArrow(ops,dest);
						to=pnt;
						card.registerDropSuccess(false);
					}
        }
        else
         card.registerDropSuccess(false);
			}
			else
			{
				CardReceptor rc=eventData.pointerDrag.GetComponent<CardReceptor>();
        if(cardData.hasTag("DISMISS_AREA")&&rc!=null&&
           rc.cardData.hasTag(player1["dismissableTag"] as string))
        {
          rc.cardData.setTag("DESELECT");
          rc.cardData.setTag("DISMISS_MARK");
          return;
        }
				if(rc!=null&&cardData.hasTag(player1["aimTag"] as string))
				{ // this is ability resolution
					player1["AIMED"]=cardData;
					Debug.Log(rc);
					rc.DropOccurred();
					return;
				}

				if(rc!=null&&cardData.hasTag(player1["targetTag"] as string))
				   {
					player1["TARGETED"]=cardData;
					Debug.Log(rc);
					rc.DropOccurred();
               return;
				}

			}
		}

	}
Пример #39
0
 public void destroyArrow()
 {
     UnityEngine.Object.Destroy(pointer);
     pointer = null;
 }
Пример #40
0
 // Use this for initialization
 void Start()
 {
     arrow = arrowObject.GetComponent<ArrowPointer>();
 }