Inheritance: MonoBehaviour
Ejemplo n.º 1
0
        public override void SetEnablePositions(ISituation situation, out Positions enableMovein, out Positions enableCapture)
        {
            enableCapture = new Positions();
            enableMovein = new Positions();

            Position aPos = this.Position.ShiftWestNorth();
            Position bPos = this.Position.ShiftEastNorth();
            Position cPos = this.Position.ShiftWestSouth();
            Position dPos = this.Position.ShiftEastSouth();
            if (aPos != Position.Empty)
            {
                Position.Shift(this.GameSide, situation, aPos.ShiftNorth(), enableMovein, enableCapture);
                Position.Shift(this.GameSide, situation, aPos.ShiftWest(), enableMovein, enableCapture);
            }
            if (bPos != Position.Empty)
            {
                Position.Shift(this.GameSide, situation, bPos.ShiftNorth(), enableMovein, enableCapture);
                Position.Shift(this.GameSide, situation, bPos.ShiftEast(), enableMovein, enableCapture);
            }
            if (cPos != Position.Empty)
            {
                Position.Shift(this.GameSide, situation, cPos.ShiftWest(), enableMovein, enableCapture);
                Position.Shift(this.GameSide, situation, cPos.ShiftSouth(), enableMovein, enableCapture);
            }
            if (dPos != Position.Empty)
            {
                Position.Shift(this.GameSide, situation, dPos.ShiftEast(), enableMovein, enableCapture);
                Position.Shift(this.GameSide, situation, dPos.ShiftSouth(), enableMovein, enableCapture);
            }
        }
 public void moveNewton(Positions newPosition)
 {
     if( newPosition == Positions.LEVEL1 ){
         transform.position = new Vector3(-77.31179f, 1.984234f, 1.453054f);
     }
     newtonPosition = newPosition;
 }
Ejemplo n.º 3
0
		/// <summary>
		/// Vérifie si une variable de type Position est en cours ou à déjà été clôturée
		/// </summary>
		/// <param name="position">Used position</param>
		/// <returns>true si la position est active, false sinon</returns>
		public static bool isAlive(this Position position, Positions positions)
		{
			var request = from p in positions select p.Id==position.Id ;

			return request!=null;

		}
Ejemplo n.º 4
0
    void movePlatform()
    {
        stepCount++;
        if(stepCount >=stepTimer)
        {
            switch(platformDirection)
            {
                case Positions.LEFT:
                    offSet = new Vector3(-stepSize, 0,0);
                    platformPosition--;
                    break;
                case Positions.RIGHT:
                    offSet = new Vector3(stepSize, 0,0);
                    platformPosition++;
                    break;      
            }


            this.transform.position += offSet;
            //Cambio de direccion
            if(platformDirection.Equals(platformPosition))
            {
                if(platformDirection.Equals(Positions.RIGHT))
                {
                    platformDirection = Positions.LEFT;
                }
                else
                {
                    platformDirection = Positions.RIGHT;
                }
            }
        }
    }
Ejemplo n.º 5
0
 public override void SetEnablePositions(ISituation situation, out Positions enableMovein, out Positions enableCapture)
 {
     enableMovein = new Positions();
     enableCapture = new Positions();
     PieceRook.RookShift(this.GameSide, situation, this.Position, enableMovein, enableCapture);
     PieceBishop.BishopShift(this.GameSide, situation, this.Position, enableMovein, enableCapture);
 }
Ejemplo n.º 6
0
 public AddVToPosCommand(Graph gr,Positions pos,int x, int y)
 {
     innGraph = gr;
     _pos = pos;
     _x = x;
     _y = y;
 }
Ejemplo n.º 7
0
	    public IHttpActionResult Post([FromBody]AddNewPositionModel model)
		{
            var term = termManager.GetById(model.termId);
            ClientTermViewModel result = null;

            var product = productManager.GetById(model.productId);
            var user = userManager.GetByLogin(model.Login);

            if (user != null && user.Token == model.Token &&
                product != null && term != null)
            {
                var newPosition = new Positions()
                {
                    Amount = 1, //TODO
                    Description = product.Name,
                    ProductId = product.Id,
                    Price = product.Price,
                    OrderId = term.OrderId,
                };

                positionsManager.AddEntity(newPosition);
                

                var newTermPosition = new TermPositions()
                {
                    TermId = term.Id,
                    Amount = 1, //TODO
                    Positions = newPosition,
                    TermPositionMaterialRsps = new List<TermPositionMaterialRsp>()
                };

                term.TermPositions.Add(newTermPosition);


                //add linked material to position
                foreach (var material in product.ProductMaterialRsps.Where(o => !o.DeleteDate.HasValue))
                {
                    newTermPosition.TermPositionMaterialRsps.Add(new TermPositionMaterialRsp()
                    {
                        Amount = material.Amount,
                        MaterialId = material.MaterialId,
                        TermPositions = newTermPosition 
                    });
                }

                positionsManager.SaveChanges();



                if (term != null)
                {
                    result = TermViewModelHelper.ToModel(term, true, false);
                }

                return Ok(result);
            }

            return BadRequest();
		}
Ejemplo n.º 8
0
 /// <summary> 
 /// Returns Positions.Left if the position is Positions.Right, 
 /// Positions.Right if the position is Left, or the position
 /// otherwise.
 /// </summary>
 /// <param name="position"></param>
 public static Positions Opposite(Positions position)
 {
     if (position == Positions.Left)
         return Positions.Right;
     if (position == Positions.Right)
         return Positions.Left;
     return position;
 }
Ejemplo n.º 9
0
 public Worker(string Name, int Age, Positions Position, double Wage, int BranchID)
 {
     this.Name = Name;
     this.Age = Age;
     this.Position = Position;
     this.Wage = Wage;
     this.BranchID = BranchID;
 }
Ejemplo n.º 10
0
 public void moveNewton(Positions newPosition)
 {
     if( newPosition == Positions.LAB ){
         transform.position = new Vector3(-4.748125f, 1.238406f, -8.060616f);
     } else if ( newPosition == Positions.LEVEL1 ){
         transform.position = new Vector3(-35.4f, 1.238406f, -26.3f);
     }
     newtonPosition = newPosition;
 }
Ejemplo n.º 11
0
        public VertexVievModel(Vertex v, Graph g, Positions p, Names n)
        {
            vertex= v;

            graph = g;
            positionedGraph = p;

            namedGraph = n;
        }
Ejemplo n.º 12
0
 void Start()
 {
     state = States.INTRO;
     newtonPosition = Positions.LAB;
     fpsInput = GameObject.Find("Player").GetComponent("FPSInputController") as FPSInputController;
     consoleController = GameObject.Find("console").GetComponent("ConsoleController") as ConsoleController;
     gameController = GameObject.Find("Controller").GetComponent("GameController") as GameController;
     ramTrigger = GameObject.Find("ram").GetComponent("RamTrigger") as RamTrigger;
     Player = GameObject.Find("Player");
 }
Ejemplo n.º 13
0
 /// <summary>
 /// Calls GetDepth and SetDepth.
 /// </summary>
 /// <param name="geomIndex"></param>
 /// <param name="posIndex"></param>
 /// <returns></returns>
 public int this[int geomIndex, Positions posIndex]
 {
     get
     {
         return GetDepth(geomIndex, posIndex);
     }
     set
     {
         SetDepth(geomIndex, posIndex, value);
     }
 }
Ejemplo n.º 14
0
 public void LoadWindow(Control control, Positions position)
 {
     if (position == Positions.Main)
     {
         flowLayoutPanelMain.Controls.Clear();
         flowLayoutPanelMain.Controls.Add(control);
     }
     else if(position == Positions.Navigation)
     {
         flowLayoutPanelWest.Controls.Clear();
         flowLayoutPanelWest.Controls.Add(control);
     }
 }
Ejemplo n.º 15
0
        public override void SetEnablePositions(ISituation situation, out Positions enableMovein, out Positions enableCapture)
        {
            enableMovein = new Positions();
            enableCapture = new Positions();

            Position.Shift(this.GameSide, situation, this.Position.ShiftEast(), enableMovein, enableCapture);
            Position.Shift(this.GameSide, situation, this.Position.ShiftSouth(), enableMovein, enableCapture);
            Position.Shift(this.GameSide, situation, this.Position.ShiftWest(), enableMovein, enableCapture);
            Position.Shift(this.GameSide, situation, this.Position.ShiftNorth(), enableMovein, enableCapture);
            Position.Shift(this.GameSide, situation, this.Position.ShiftEastNorth(), enableMovein, enableCapture);
            Position.Shift(this.GameSide, situation, this.Position.ShiftEastSouth(), enableMovein, enableCapture);
            Position.Shift(this.GameSide, situation, this.Position.ShiftWestNorth(), enableMovein, enableCapture);
            Position.Shift(this.GameSide, situation, this.Position.ShiftWestSouth(), enableMovein, enableCapture);
        }
Ejemplo n.º 16
0
        public Player(Positions pos, String name, int ID, int Salary, double points)
        {
            mPosition = pos;
            mName = name;
            mID = ID;
            mSalary = Salary;
            mAvgFantasyPoints = points;

            if (mAvgFantasyPoints > 0)
            {
                mDollarsPerPoint = (mSalary / mAvgFantasyPoints);
            }
            else
            {
                mDollarsPerPoint = 0;
            }
        }
Ejemplo n.º 17
0
 private void Awake()
 {
     theTransform = transform;
     anim = GetComponent<Animator>();
     playerH = GetComponent<PlayerHealth>();
     rigid = GetComponent<Rigidbody2D>();
     positions = GameObject.FindWithTag("Scripts").GetComponent<Positions>();
     reset = GameObject.FindWithTag("Scripts").GetComponent<Reset>();
     enemies = GameObject.FindGameObjectsWithTag("Enemy");
     tips = GameObject.FindWithTag("UI").GetComponent<HelpfulTips>();
     showPanels = GameObject.FindWithTag("UI").GetComponent<ShowPanels>();
     scenes = GameObject.FindWithTag("Scripts").GetComponent<Scenes>();
     if (!isRight)
         reset.ResetHelmet();
     rigid.gravityScale = 0f;
     GetComponentInChildren<SpriteRenderer>().enabled = false;
 }
Ejemplo n.º 18
0
        public IHttpActionResult Put(OrdersModel model)
        {
            var order = manager.GetById(model.Id);

            var newOrder = new Orders()
            {
                AutoBill = order.AutoBill,
                City = order.City,
                Comment = order.Comment,
                CommunicationPartnerId = order.CommunicationPartnerId,
                CustomerId = order.CustomerId,
                Discount = order.Discount,
                Street = order.Street,
                Status = (int)OrderStatusTypes.Open,
                Zip = order.Zip,
                IsOffer = false,
                OrderNumber = numberProvider.GetNextOrderNumber(),
                Positions = new List<Positions>(),
                CreateDate = DateTime.Now,
                ChangeDate = DateTime.Now,
            };
            
            manager.AddEntity(newOrder);

            foreach(var position in order.Positions.Where(o => o.MaterialId.HasValue && !o.DeleteDate.HasValue).ToList())
            {
                var newPosition = new Positions()
                {
                    MaterialId = position.MaterialId.Value,
                    IsAlternative = position.IsAlternative,
                    IsMaterialPosition = position.IsMaterialPosition,
                    Amount = position.Amount,
                    Price = position.Price,
                    PaymentType = position.PaymentType,
                    Orders = newOrder
                };

                positionManager.AddEntity(newPosition);
                newOrder.Positions.Add(newPosition);
            }

            manager.SaveChanges();

            return Ok(new { id = newOrder.Id });
        }
Ejemplo n.º 19
0
	// Use this for initialization
	void Start () {
        stepCount = 0;
        stepSize = platform.GetComponent<Renderer>().bounds.size.x;
        offSet = new Vector3(0, 0,0);
        InvokeRepeating("movePlatform", 0, stepTimer);

        if (platformDirection.Equals(platformPosition))
        {
            if (platformDirection.Equals(Positions.RIGHT))
            {
                platformDirection = Positions.LEFT;
            }
            else
            {
                platformDirection = Positions.RIGHT;
            }
        }

    }
Ejemplo n.º 20
0
        /// <summary>
        /// 象的基本路线(即斜向)
        /// </summary>
        internal static void BishopShift(
            Enums.GameSide side, ISituation situation, Position position,
            Positions moveInPs, Positions capturePs)
        {
            bool canContine = true;
            Position tgtPos = Position.Empty;

            canContine = true;
            tgtPos = position;
            while (canContine)
            {
                tgtPos = tgtPos.ShiftEastNorth();
                canContine = Position.Shift(side, situation, tgtPos, moveInPs, capturePs);
            }

            canContine = true;
            tgtPos = position;
            while (canContine)
            {
                tgtPos = tgtPos.ShiftEastSouth();
                canContine = Position.Shift(side, situation, tgtPos, moveInPs, capturePs);
            }

            canContine = true;
            tgtPos = position;
            while (canContine)
            {
                tgtPos = tgtPos.ShiftWestNorth();
                canContine = Position.Shift(side, situation, tgtPos, moveInPs, capturePs);
            }

            canContine = true;
            tgtPos = position;
            while (canContine)
            {
                tgtPos = tgtPos.ShiftWestSouth();
                canContine = Position.Shift(side, situation, tgtPos, moveInPs, capturePs);
            }
        }
Ejemplo n.º 21
0
	    public IHttpActionResult Post([FromBody]AddNewMaterialModel model)
		{
            var term = termManager.GetById(model.termId);
            ClientTermViewModel result = null;

            var material = materialManager.GetById(model.materialId);
            var user = userManager.GetByLogin(model.Login);

            if (user != null && user.Token == model.Token &&
                material != null && term != null)
            {
                var newPosition = new Positions()
                {
                    Amount = 1, //TODO
                    Description = material.Name,
                    MaterialId = material.Id,
                    Price = material.Price,
                    OrderId = term.OrderId,
                    IsMaterialPosition = true,
                    TermId = term.Id,
                    CreateDate = DateTime.Now,
                    ChangeDate = DateTime.Now,
                };

                positionsManager.AddEntity(newPosition);

                positionsManager.SaveChanges();

                if (term != null)
                {
                    result = TermViewModelHelper.ToModel(term, false, true);
                }

                return Ok(result);
            }

            return BadRequest();
		}
Ejemplo n.º 22
0
        private void ComputeRingBufferCurve(Coordinate[] inputPts, Positions side, OffsetSegmentGenerator segGen)
        {
            // simplify input line to improve performance
            var distTol = SimplifyTolerance(_distance);
            // ensure that correct side is simplified
            if (side == Positions.Right)
                distTol = -distTol;
            var simp = BufferInputLineSimplifier.Simplify(inputPts, distTol);
            // MD - used for testing only (to eliminate simplification)
            // Coordinate[] simp = inputPts;

            var n = simp.Length - 1;
            segGen.InitSideSegments(simp[n - 1], simp[0], side);
            for (var i = 1; i <= n; i++)
            {
                var addStartPoint = i != 1;
                segGen.AddNextSegment(simp[i], addStartPoint);
            }
            segGen.CloseRing();
        }
Ejemplo n.º 23
0
        /// <summary>
        /// This method handles the degenerate cases of single points and lines,
        /// as well as rings.
        /// </summary>
        /// <returns>A Coordinate array representing the curve<br/>
        /// or <c>null</c> if the curve is empty</returns>
        public Coordinate[] GetRingCurve(Coordinate[] inputPts, Positions side, double distance)
        {
            _distance = distance;
            if (inputPts.Length <= 2)
                return GetLineCurve(inputPts, distance);

            // optimize creating ring for for zero distance
            if (distance == 0.0)
            {
                return CopyCoordinates(inputPts);
            }
            OffsetSegmentGenerator segGen = GetSegmentGenerator(distance);
            ComputeRingBufferCurve(inputPts, side, segGen);
            return segGen.GetCoordinates();
        }
Ejemplo n.º 24
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="geomIndex"></param>
 /// <param name="posIndex"></param>
 /// <param name="_location"></param>
 public  void SetLocation(int geomIndex, Positions posIndex, Location _location)
 {
     elt[geomIndex].SetLocation(posIndex, _location);
 }
Ejemplo n.º 25
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="geomIndex"></param>
 /// <param name="posIndex"></param>
 /// <returns></returns>
 public  Location GetLocation(int geomIndex, Positions posIndex) 
 { 
     return elt[geomIndex].Get(posIndex); 
 }
Ejemplo n.º 26
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="geomIndex"></param>
 /// <param name="posIndex"></param>
 /// <returns></returns>
 public Locations GetLocation(int geomIndex, Positions posIndex)
 {
     if (depth[geomIndex, (int)posIndex] <= 0) 
         return Locations.Exterior;
     return Locations.Interior;
 }
Ejemplo n.º 27
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="geomIndex"></param>
 /// <param name="posIndex"></param>
 /// <param name="depthValue"></param>
 public void SetDepth(int geomIndex, Positions posIndex, int depthValue)
 {
     depth[geomIndex, (int)posIndex] = depthValue;
 }
Ejemplo n.º 28
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="geomIndex"></param>
 /// <param name="posIndex"></param>
 /// <returns></returns>
 public int GetDepth(int geomIndex, Positions posIndex)
 {
     return depth[geomIndex, (int)posIndex];
 }
Ejemplo n.º 29
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="geomIndex"></param>
 /// <param name="posIndex"></param>
 /// <returns></returns>
 public bool IsNull(int geomIndex, Positions posIndex)
 {
     return depth[geomIndex,(int)posIndex] == Null;
 }
Ejemplo n.º 30
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="geomIndex"></param>
 /// <param name="posIndex"></param>
 /// <param name="location"></param>
 public void Add(int geomIndex, Positions posIndex, Locations location)
 {
     if (location == Locations.Interior)
         depth[geomIndex, (int)posIndex]++;
 }