예제 #1
0
 /// <summary>
 /// Sets new values for a given Vector2 cartesian.
 /// </summary>
 public void Set(float radius, float azimuth, float height, BasePlane plane = BasePlane.XZ)
 {
     this.radius  = radius;
     this.azimuth = azimuth;
     this.height  = height;
     this.plane   = plane;
 }
예제 #2
0
파일: RobotCell.cs 프로젝트: visose/Robots
    internal RobotCell(string name, Manufacturers manufacturer, List <MechanicalGroup> mechanicalGroups, IO io, Plane basePlane, Mesh?environment)
        : base(name, manufacturer, io, basePlane, environment, GetDefaultPose(mechanicalGroups))
    {
        MechanicalGroups = mechanicalGroups;
        foreach (var group in mechanicalGroups)
        {
            var movesRobot   = group.Externals.Find(m => m.MovesRobot);
            var robotDisplay = group.Robot.DisplayMesh;

            if (movesRobot is not null)
            {
                var movableBase = movesRobot.Joints.Last().Plane;
                movableBase.Orient(ref movesRobot.BasePlane);
                robotDisplay.Transform(movableBase.ToTransform());
            }

            DisplayMesh.Append(robotDisplay);

            foreach (var external in group.Externals)
            {
                DisplayMesh.Append(external.DisplayMesh);
            }
        }

        DisplayMesh.Transform(BasePlane.ToTransform());
    }
예제 #3
0
    public void Start()
    {
#if UNITY_EDITOR
        if (!UnityEditor.EditorApplication.isPlaying)
        {
            var editorBps = GetComponentsInParent <BasePlane>();
            if (null != editorBps && editorBps.Length > 0)
            {
                bp = editorBps[editorBps.Length - 1];
            }
            else
            {
                bp = null;
            }
            return;
        }
#endif
        if (null == bp || !bp.IsRealyPlane())
        {
            var bps = GetComponentsInParent <BasePlane>();
            if (null != bps && bps.Length > 0)
            {
                for (int i = bps.Length - 1; i >= 0; --i)
                {
                    if (bps[i].IsRealyPlane())
                    {
                        bp = bps[i];
                    }
                }
            }
        }
    }
예제 #4
0
 public virtual void OnHit(BasePlane _plane)
 {
     _plane.OnHit(owner.Atk * this.hitFactor);
     if (bStrike == false)
     {
         OnBomb();
     }
 }
예제 #5
0
 public void setXYZ(int x, int y, int z, BasePlane p)
 {
     this.x = x;
     this.y = y;
     this.z = z;
     this.p = p;
     pos    = this.transform.position;
 }
예제 #6
0
    // public URRealTime URRealTime { get; set; }

    internal RobotSystemUR(string name, RobotUR robot, IO io, Plane basePlane, Mesh?environment)
        : base(name, Manufacturers.UR, io, basePlane, environment, GetDefaultPose(robot))
    {
        Remote = new RemoteUR();
        Robot  = robot;
        DisplayMesh.Append(robot.DisplayMesh);
        DisplayMesh.Transform(BasePlane.ToTransform());
    }
예제 #7
0
        public override void Transform(Transform x)
        {
            for (int i = 0; i < Branches.Length; ++i)
            {
                Branches[i].Transform(x);
            }

            BasePlane.Transform(x);
        }
예제 #8
0
 /// <summary>
 /// Geometry is constructed with lower left corner at (0,0). Move and rotate into place.
 /// </summary>
 private TGeometryType TransformFromOrigin <TGeometryType>(TGeometryType geometry)
     where TGeometryType : Geometry
 {
     using (var baseSystem = CoordinateSystem.ByOrigin(Width / 2, Length / 2))
         using (var targetSystem = BasePlane.ToCoordinateSystem())
         {
             // Surface is constructed with lower left corner at (0,0). Move and rotate to given base plane.
             return((TGeometryType)geometry.Transform(baseSystem, targetSystem));
         }
 }
예제 #9
0
        Mesh CreateDisplayMesh()
        {
            var mesh = new Mesh();
            mesh.Append(BaseMesh);

            foreach (var joint in Joints)
                mesh.Append(joint.Mesh);

            mesh.Transform(BasePlane.ToTransform());
            return mesh;
        }
예제 #10
0
        public bool CalculateCircle(Point3d testPoint)
        {
            var rc    = false;
            var point = BasePlane.ClosestPoint(testPoint);
            var dir   = point - BasePlane.Origin;

            if (!dir.IsTiny())
            {
                Circle = new Circle(BasePlane, dir.Length);
                rc     = Circle.IsValid;
            }
            return(rc);
        }
예제 #11
0
파일: Mechanism.cs 프로젝트: visose/Robots
    Mesh CreateDisplayMesh()
    {
        var mesh = new Mesh();

        if (BaseMesh is null)
        {
            return(mesh);
        }

        mesh.Append(BaseMesh);

        foreach (var joint in Joints)
        {
            mesh.Append(joint.Mesh);
        }

        mesh.Transform(BasePlane.ToTransform());
        return(mesh);
    }
예제 #12
0
    private void CreatePlane()
    {
        bool fireState = false;

        if (planeActive)
        {
            fireState = planeActive.fire.onAttack;
            planeActive.EvDead.RemoveListener(TransferEvDead);
            GetHealth().EvChangeNormal.RemoveListener(ChenchHeath);
            Destroy(planeActive.gameObject);
        }

        planeActive = Creator.Inctance.GetGO(basePlaneLevel[level.Value].gameObject, transform.position, transform).GetComponent <BasePlane>();

        planeActive.EvDead.AddListener(TransferEvDead);
        GetHealth().EvChangeNormal.AddListener(ChenchHeath);
        ChenchHeath(GetHealth().GetNormal());
        planeActive.fire.Attack(fireState);
    }
예제 #13
0
    void CreateEnemy()
    {
        int       planeTypeRange = Random.Range(0, 100);
        BasePlane plane          = null;

        if (planeTypeRange < 70)
        {
            plane = CreatePlane(PlaneType.enemy1);
        }
        else if (planeTypeRange < 80)
        {
            plane = CreatePlane(PlaneType.enemy2);
        }
        else
        {
            plane = CreatePlane(PlaneType.enemy3);
        }
        float x = Random.Range(-1.5f, 1.5f);

        plane.transform.position = new Vector2(x, transform.position.y);
    }
예제 #14
0
 public void SetOwner(BasePlane _owner)
 {
     owner = _owner;
 }
예제 #15
0
 /// <summary>
 /// Sets new values for a given Polar.
 /// </summary>
 public void Set(Vector3 cartesian, BasePlane plane = BasePlane.XZ)
 {
     this.plane = plane;
     ToPolar(cartesian);
     this.height = (plane == BasePlane.XY) ? cartesian.z : cartesian.y;
 }
예제 #16
0
 /// <summary>
 /// Sets new values for a given Polar.
 /// </summary>
 public void Set(Vector2 cartesian, BasePlane plane = BasePlane.XZ)
 {
     this.plane = plane;
     ToPolar(cartesian);
     this.height = 0f;
 }
예제 #17
0
 /// <summary>
 /// Constructs a new Polar, given a radius and azimuth. Angle in radians.
 /// </summary>
 public Polar(float radius, float azimuth, float height = 0f, BasePlane plane = BasePlane.XZ) : this()
 {
     Set(radius, azimuth, height, plane);
 }
예제 #18
0
 /// <summary>
 /// Constructs a new Polar, given a Vector3 cartesian. Angle in radians.
 /// </summary>
 public Polar(Vector3 cartesian, BasePlane plane = BasePlane.XZ) : this()
 {
     Set(cartesian, plane);
 }
예제 #19
0
        public static Vector2 PolarToCartesian(float radius, float azimuth, float height = 0f, BasePlane plane = BasePlane.XZ)
        {
            Polar cartesian = new Polar(radius, azimuth, height, plane);

            return(cartesian);
        }
예제 #20
0
        public static Polar CartesianToPolar(Vector3 cartesian, BasePlane plane = BasePlane.XZ)
        {
            Polar polar = new Polar(cartesian, plane);

            return(polar);
        }
예제 #21
0
 void OnEnable()
 {
     np = target as BasePlane;
     Init();
 }
예제 #22
0
 public override void GenerateHash( )
 {
     base.GenerateHash();
     this.GeometryHash += GetMd5FromObject(BasePlane.ToJson() + XSize.ToJson() + YSize.ToJson() + ZSize.ToJson());
     this.Hash          = GetMd5FromObject(this);
 }
예제 #23
0
 void Start()
 {
     plane = GetComponent <BasePlane>();
 }
예제 #24
0
 public void OnPlaneDead(BasePlane _plane)
 {
     // GameObject.Destroy(_plane.gameObject);
 }