コード例 #1
0
ファイル: AIPlayer.cs プロジェクト: Blueteak/MazeWar
	IntVector randomPos()
	{
		IntVector nVec = new IntVector(UnityEngine.Random.Range(0,(int)m.Dimensions().x), UnityEngine.Random.Range(0, (int)m.Dimensions().y));
		while(m.GetCell(nVec.x, nVec.y).isWall)
			nVec = new IntVector(UnityEngine.Random.Range(0,(int)m.Dimensions().x), UnityEngine.Random.Range(0, (int)m.Dimensions().y));
		return nVec;
	}
コード例 #2
0
ファイル: IntVectorFixture.cs プロジェクト: Kasmatos/Training
 public void MustReturnCorrectValues()
 {
     var v = new IntVector(2);
     v.Push(100);
     v.Push(200);
     v.Push(300);
     Assert.AreEqual(3, v.Size);
     Assert.AreEqual(100, v[0]);
     Assert.AreEqual(200, v[1]);
     Assert.AreEqual(300, v[2]);
 }
コード例 #3
0
ファイル: IntVectorFixture.cs プロジェクト: Kasmatos/Training
        public void MustBeFilledWithTheSingleValue()
        {
            const int fillValue = 1234;
            var v = new IntVector(33, fillValue);

            Assert.AreEqual(33, v.Size);
            foreach(int value in v)
            {
                Assert.AreEqual(fillValue, value);
            }
        }
コード例 #4
0
ファイル: IntVector.cs プロジェクト: Anshul-Bansal/gsoc
  public static int[] get_vector(IntVector src) {
		IntPtr ptr = modshogunPINVOKE.IntVector_get_vector__SWIG_1(IntVector.getCPtr(src));
    if (modshogunPINVOKE.SWIGPendingException.Pending) throw modshogunPINVOKE.SWIGPendingException.Retrieve();
		int[] size = new int[1];
		Marshal.Copy(ptr, size, 0, 1);

		int len = size[0];

		int[] ret = new int[len];

		Marshal.Copy(new IntPtr(ptr.ToInt64() + Marshal.SizeOf(typeof(int))), ret, 0, len);
		return ret;
}
コード例 #5
0
ファイル: IntVectorFixture.cs プロジェクト: Kasmatos/Training
        public void GetHashCodeMustBeDifferent()
        {
            var v1 = new IntVector(3);
            v1.Push(100);
            v1.Push(200);
            v1.Push(300);

            var v2 = new IntVector(3);
            v2.Push(101);
            v2.Push(200);
            v2.Push(300);

            Assert.AreNotEqual(v1.GetHashCode(), v2.GetHashCode());
        }
コード例 #6
0
ファイル: Merger.cs プロジェクト: chartek/graffiticms
        public Merger(string original, string modified)
        {
            // parse the passed in string to words
            // collections
            _original = HtmlTextParser.parse(original);
            _modified = HtmlTextParser.parse(modified);

            // for hold the forward searching front-line
            // in previous searching loop
            fwdVector = new IntVector(_original.Count + _modified.Count);

            // for hold the backward searching front-line
            // in the previous seaching loop
            bwdVector = new IntVector(_original.Count + _modified.Count);
        }
コード例 #7
0
ファイル: IntVectorFixture.cs プロジェクト: Kasmatos/Training
        public void OperatorEquals()
        {
            var v1 = new IntVector(3);
            v1.Push(100);
            v1.Push(200);
            v1.Push(300);
            IntVector v2 = v1;

            Assert.IsTrue(v1==v2);
            Assert.IsFalse(v1 == null);

            v2 = null;
            Assert.IsTrue(v2 == null);

            v2 = new IntVector(3);
            v2.Push(100);
            v2.Push(200);
            v2.Push(300);
            Assert.IsTrue(v1 == v2);
            Assert.IsTrue(v2 == v1);
            Assert.IsFalse(v1 != v2);
            Assert.IsFalse(v2 != v1);
        }
コード例 #8
0
ファイル: Inventory.cs プロジェクト: jklw10/ROQWE
 /// <summary>
 /// changes item at position to item
 /// </summary>
 /// <param name="position"></param>
 /// <param name="item"></param>
 public void SetItem(IntVector position, Item item)
 {
     itemArray[position.X, position.Y] = item;
 }
コード例 #9
0
 private bool IsEven(IntVector intVector)
 {
     return(intVector.X % 2 == 0 && intVector.Y % 2 == 0);
 }
コード例 #10
0
        public void Update()
        {
            if (Player.main != null)
            {
                if (Input.GetKeyDown(CmConfig.KEYBINDINGS["ToggleWindow"]))
                {
                    isActive = !isActive;
                }

                if (!isActive)
                {
                    return;
                }

                if (Input.GetKeyDown(CmConfig.KEYBINDINGS["ToggleMouse"]))
                {
                    UWE.Utils.lockCursor = !UWE.Utils.lockCursor;
                }

                if (!initToggleButtons && !uGUI.main.loading.IsLoading)
                {
                    SetToggleButtons();
                    initToggleButtons = true;
                    UpdateButtonsState();
                }

                if (CommandsGroup.ItemID != -1 && CommandsGroup.MouseButton == 0)
                {
                    NormalButtonControl(CommandsGroup.ItemID, ref commands, ref toggleCommands);
                }

                if (ToggleCommandsGroup.ItemID != -1 && ToggleCommandsGroup.MouseButton == 0)
                {
                    ToggleButtonControl(ToggleCommandsGroup.ItemID, ref toggleCommands);
                }

                if (DayNightGroup.ItemID != -1 && DayNightGroup.MouseButton == 0)
                {
                    DayNightButtonControl(DayNightGroup.ItemID, ref currentdaynightTab, ref daynightTab);
                }

                if (CategoriesGroup.ItemID != -1 && CategoriesGroup.MouseButton == 0)
                {
                    if (CategoriesGroup.ItemID != currentTab)
                    {
                        //categoriesTab[currentTab].State = SNGUI.SetStateInverse(categoriesTab[currentTab].State);
                        //categoriesTab[categoriesTabID].State = SNGUI.SetStateInverse(categoriesTab[categoriesTabID].State);
                        currentTab = CategoriesGroup.ItemID;
                        scrollPos  = Vector2.zero;
                    }
                }

                if (ScrollViewGroup.ItemID != -1)
                {
                    if (ScrollViewGroup.MouseButton == 0)
                    {
                        ScrollViewControl(currentTab, ScrollViewGroup.ItemID, ref scrollItemsList[currentTab], ref tMatrix, ref commands);
                    }
                    else if (currentTab == 19 && ScrollViewGroup.MouseButton == 1)
                    {
                        if (ScrollViewGroup.ItemID < WarpTargets_Internal.Count)
                        {
                            ErrorMessage.AddMessage($"CheatManager Warning!\nInternal list items cannot be selected!");
                            return;
                        }

                        scrollItemsList[currentTab].UnmarkAll();
                        scrollItemsList[currentTab][ScrollViewGroup.ItemID].SetStateInverse();
                    }
                }

                if (VehicleSettingsGroup.ItemID != -1 && VehicleSettingsGroup.MouseButton == 0)
                {
                    if (VehicleSettingsGroup.ItemID == 0)
                    {
                        isSeamothCanFly.Update(!isSeamothCanFly.value);
                        vehicleSettings[0].State = SNGUI.ConvertBoolToState(isSeamothCanFly.value);
                    }

                    if (VehicleSettingsGroup.ItemID == 1)
                    {
                        isSeaglideFast.Update(!isSeaglideFast.value);
                        vehicleSettings[1].State = SNGUI.ConvertBoolToState(isSeaglideFast.value);
                    }
                }

                if (WarpExtrasGroup.ItemID != -1 && WarpExtrasGroup.MouseButton == 0)
                {
                    if (WarpExtrasGroup.ItemID == 0)
                    {
                        IntVector position = new IntVector(Player.main.transform.position);

                        if (IsPositionWithinRange(position, out string nearestWarpName))
                        {
                            ErrorMessage.AddMessage($"CheatManagerZero Warning!\nThis position cannot be added to the Warp list\nbecause it is very close to:\n{nearestWarpName} warp point!");
                        }
                        else
                        {
                            AddToList(position);
                        }
                    }

                    if (WarpExtrasGroup.ItemID == 1)
                    {
                        int item = scrollItemsList[currentTab].GetMarkedItem();

                        if (item == -1)
                        {
                            ErrorMessage.AddMessage("CheatManagerZero Error!\nNo item selected from the user Warp list!");
                            return;
                        }

                        isDirty = true;

                        int userIndex = item - WarpTargets_Internal.Count;

                        IntVector intVector = WarpTargets_User.Keys.ElementAt(userIndex);


                        //WarpTargets_User.TryGetValue(intVector, out string value);

                        //print($"item: {item}, userIndex: {userIndex}, Internal.Count: {WarpTargets_Internal.Count}, User.Count: {WarpTargets_User.Count}");
                        //print($"Key: {intVector}, Value: {value}");
                        //print($"scrollItemsList[currentTab].Count: {scrollItemsList[currentTab].Count}");

                        RemoveFormList(intVector);

                        scrollItemsList[currentTab].RemoveGuiItemFromGroup(item);

                        isDirty = false;
                    }
                }
            }
        }
コード例 #11
0
 public T Get(IntVector position)
 {
     return(Grid.Get(CoordinateSystem.Normalize(position)));
 }
コード例 #12
0
 /// <summary>
 /// Checks, if at the coordinate location contains an asteroid
 /// </summary>
 /// <param name="coordinates"></param>
 /// <returns></returns>
 private bool ContainsAsteroid(IntVector position)
 {
     return(_asteroidMap[position.Y][position.X] == '#');
 }
コード例 #13
0
 /// <summary>
 /// Get the direction from the system to an asteroid
 /// </summary>
 /// <returns></returns>
 private IntVector GetDirection(IntVector pol, IntVector coordinates)
 {
     return(new IntVector(coordinates.X - pol.X, pol.Y - coordinates.Y));
 }
コード例 #14
0
ファイル: IntVector.cs プロジェクト: Anshul-Bansal/gsoc
 public IntVector(IntVector orig) : this(modshogunPINVOKE.new_IntVector__SWIG_5(IntVector.getCPtr(orig)), true) {
   if (modshogunPINVOKE.SWIGPendingException.Pending) throw modshogunPINVOKE.SWIGPendingException.Retrieve();
 }
コード例 #15
0
ファイル: Room.cs プロジェクト: filthmancer/Lil-Turnie
 public void Init(IntVector size)
 {
     GenerateGrid(size);
 }
コード例 #16
0
ファイル: IntVectorFixture.cs プロジェクト: Kasmatos/Training
 public void MustThrowExceptionIfOutRange()
 {
     var v = new IntVector(1);
     Assert.Catch<IndexOutOfRangeException>(() => { int i = v[1]; });
     Assert.Catch<InvalidOperationException>(() => v.Pop());
 }
コード例 #17
0
ファイル: AIPlayer.cs プロジェクト: Blueteak/MazeWar
	void GetPathAStar()
	{
		IntVector curPos = wantPos;
		IntVector startP = new IntVector((int)control.pos().x, (int)control.pos().y);
		s += "\nRead top to bottom\n\nPath To: " + curPos.x + "," +curPos.y+"\n"; 
		int steps = 0;
		while(weights[curPos.y, curPos.x] != 0 && steps < 150)
		{
			int curWeight = weights[curPos.y, curPos.x];
			Direction d = Direction.wait;
			int mw = int.MaxValue;
			int mx = 0; int my = 0;
			if(curPos.y < weights.GetLength(0)-1 && weights[curPos.y+1, curPos.x] != -1 && !visited[curPos.y+1, curPos.x] && weights[curPos.y+1, curPos.x] <= mw)
			{
				d = Direction.down;
				mw = weights[curPos.y+1, curPos.x];
				mx = curPos.y+1; my = curPos.x;
			}
			if(curPos.y > 0 && weights[curPos.y-1, curPos.x] <= mw && weights[curPos.y-1, curPos.x] != -1 && !visited[curPos.y-1, curPos.x])
			{
				mw = weights[curPos.y -1, curPos.x]; mx = curPos.y-1; my = curPos.x;
				d = Direction.up;
			}
			if(curPos.x > 0 && weights[curPos.y, curPos.x-1] <= mw && weights[curPos.y, curPos.x-1] != -1 && !visited[curPos.y, curPos.x-1])
			{
				mw = weights[curPos.y, curPos.x-1]; mx = curPos.y; my = curPos.x-1;
				d = Direction.right;
			}
			if(curPos.x < weights.GetLength(1)-1 && weights[curPos.y, curPos.x+1] <= mw && weights[curPos.y, curPos.x+1] != -1 && !visited[curPos.y, curPos.x+1])
			{
				mw = weights[curPos.y, curPos.x+1]; mx = curPos.y; my = curPos.x+1;
				d = Direction.left;
			}
			if(d != Direction.wait)
			{
				s += "\n"+steps+ " : " + d + " to " + my + "," + mx + " -- Weight: " + weights[mx, my];
				MoveQ.Push(d);
				visited[curPos.y, curPos.x] = true;
				curPos.y = mx; curPos.x = my;
			}
			steps++;
		}
		s+= "\n\nFrom: " + startP.x + "," +startP.y;
	}
コード例 #18
0
ファイル: Endpoint.cs プロジェクト: Reltik/PJSip-CSharp
 public IntVector utilSslGetAvailableCiphers()
 {
     IntVector ret = new IntVector(pjsua2PINVOKE.Endpoint_utilSslGetAvailableCiphers(swigCPtr), true);
     if (pjsua2PINVOKE.SWIGPendingException.Pending) throw pjsua2PINVOKE.SWIGPendingException.Retrieve();
     return ret;
 }
コード例 #19
0
ファイル: Endpoint.cs プロジェクト: Reltik/PJSip-CSharp
 public IntVector transportEnum()
 {
     IntVector ret = new IntVector(pjsua2PINVOKE.Endpoint_transportEnum(swigCPtr), true);
     if (pjsua2PINVOKE.SWIGPendingException.Pending) throw pjsua2PINVOKE.SWIGPendingException.Retrieve();
     return ret;
 }
コード例 #20
0
 /// <summary>
 /// Moves the hull painting robot 1 panel to its current direction
 /// </summary>
 private void Move()
 {
     CurrentPosition = CurrentPosition + _facingDirection;
     SetNextInput();
 }
コード例 #21
0
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(IntVector obj)
 {
     return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr);
 }
コード例 #22
0
 public EntityData(int entityTypeId, IntVector position, Dictionary <string, object> data)
 {
     EntityTypeId = entityTypeId;
     Position     = position;
     Data         = data;
 }
コード例 #23
0
ファイル: IntVectorFixture.cs プロジェクト: Kasmatos/Training
 public void OperatorPlusMustAddValue()
 {
     var v = new IntVector(2);
     v.Push(100);
     v.Push(200);
     v.Push(300);
     v += 10;
     Assert.AreEqual(110, v[0]);
     Assert.AreEqual(210, v[1]);
     Assert.AreEqual(310, v[2]);
 }
コード例 #24
0
ファイル: AIPlayer.cs プロジェクト: Blueteak/MazeWar
	void SetPos()
	{
		if(hc != null)
		{
			MoveQ.Push(Direction.wait);
			Debug.Log("Locked onto new Target");
			wantPos = new IntVector((int)hc.pos().x, (int)hc.pos().y);
			GetPath();
		}
	}
コード例 #25
0
 public IntVector GetIndices()
 {
     IntVector ret = new IntVector(SharpMochaPINVOKE.Mesh_GetIndices(swigCPtr), false);
     return ret;
 }
コード例 #26
0
 public virtual void Initialize(IntVector position, MapInfo mapInfo)
 {
     base.Initialize(position);
     MapInfo = mapInfo;
 }
コード例 #27
0
 internal static HandleRef getCPtr(IntVector obj) {
   return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
 }
コード例 #28
0
 internal Node(int index, IntVector point)
 {
     this.index = index;
     this.point = point;
 }
コード例 #29
0
  public static void Main() {
    // Setup collection
    DoubleVector vect = new DoubleVector();
    for (int i=0; i<collectionSize; i++) {
      double num = i*10.1;
      vect.Add(num);
    }

    // Count property test
    if (vect.Count != collectionSize)
      throw new Exception("Count test failed");

    // IsFixedSize property test
    if (vect.IsFixedSize)
      throw new Exception("IsFixedSize test failed");

    // IsReadOnly property test
    if (vect.IsReadOnly)
      throw new Exception("IsReadOnly test failed");

    // Item indexing
    vect[0] = 200.1;
    if (vect[0] != 200.1)
      throw new Exception("Item property test failed");
    vect[0] = 0*10.1;
    try {
      vect[-1] = 777.1;
      throw new Exception("Item out of range (1) test failed");
    } catch (ArgumentOutOfRangeException) {
    }
    try {
      vect[vect.Count] = 777.1;
      throw new Exception("Item out of range (2) test failed");
    } catch (ArgumentOutOfRangeException) {
    }

    // CopyTo() test
    {
      double[] outputarray = new double[collectionSize];
      vect.CopyTo(outputarray);
      int index = 0;
      foreach(double val in outputarray) {
        if (vect[index] != val)
          throw new Exception("CopyTo (1) test failed, index:" + index);
        index++;
      }
    }
    {
      double[] outputarray = new double[midCollection+collectionSize];
      vect.CopyTo(outputarray, midCollection);
      int index = midCollection;
      foreach(double val in vect) {
        if (outputarray[index] != val)
          throw new Exception("CopyTo (2) test failed, index:" + index);
        index++;
      }
    }
    {
      double[] outputarray = new double[3];
      vect.CopyTo(10, outputarray, 1, 2);
        if (outputarray[0] != 0.0 || outputarray[1] != vect[10] || outputarray[2] != vect[11])
          throw new Exception("CopyTo (3) test failed");
    }
    {
      double[] outputarray = new double[collectionSize-1];
      try {
        vect.CopyTo(outputarray);
        throw new Exception("CopyTo (4) test failed");
      } catch (ArgumentException) {
      }
    }
    {
      StructVector inputvector = new StructVector();
      int arrayLen = 10;
      for (int i=0; i<arrayLen; i++) {
        inputvector.Add(new Struct(i/10.0));
      }
      Struct[] outputarray = new Struct[arrayLen];
      inputvector.CopyTo(outputarray);
      for(int i=0; i<arrayLen; i++) {
        if (outputarray[i].num != inputvector[i].num)
          throw new Exception("CopyTo (6) test failed, i:" + i);
      }
      foreach (Struct s in inputvector) {
        s.num += 20.0;
      }
      for(int i=0; i<arrayLen; i++) {
        if (outputarray[i].num + 20.0 != inputvector[i].num )
          throw new Exception("CopyTo (7) test failed (only a shallow copy was made), i:" + i);
      }
    }
    {
      try {
        vect.CopyTo(null);
        throw new Exception("CopyTo (8) test failed");
      } catch (ArgumentNullException) {
      }
    }

    // Contains() test
    if (!vect.Contains(0*10.1))
      throw new Exception("Contains test 1 failed");
    if (!vect.Contains(10*10.1))
      throw new Exception("Contains test 2 failed");
    if (!vect.Contains(19*10.1))
      throw new Exception("Contains test 3 failed");
    if (vect.Contains(20*10.1))
      throw new Exception("Contains test 4 failed");

    {
      // ICollection constructor
      double[] doubleArray = new double[] { 0.0, 11.1, 22.2, 33.3, 44.4, 55.5, 33.3 };
      DoubleVector dv = new DoubleVector(doubleArray);
      if (doubleArray.Length != dv.Count)
        throw new Exception("ICollection constructor length check failed: " + doubleArray.Length + "-" + dv.Count);
      for (int i=0; i<doubleArray.Length; i++) {
        if (doubleArray[i] != dv[i])
          throw new Exception("ICollection constructor failed, index:" + i);
      }
      {
        Struct[] structArray = new Struct[] { new Struct(0.0), new Struct(11.1), new Struct(22.2), new Struct(33.3) };
        StructVector sv = new StructVector(structArray);
        for (int i=0; i<structArray.Length; i++) {
          structArray[i].num += 200.0;
        }
        for (int i=0; i<structArray.Length; i++) {
          if (structArray[i].num != sv[i].num + 200.0)
            throw new Exception("ICollection constructor not a deep copy, index:" + i);
        }
      }
      try {
        new DoubleVector((System.Collections.ICollection)null);
        throw new Exception("ICollection constructor null test failed");
      } catch (ArgumentNullException) {
      }
      {
        // Collection initializer test, requires C# 3.0
//        myDoubleVector = new DoubleVector() { 123.4, 567.8, 901.2 };
      }

      // IndexOf() test
      for (int i=0; i<collectionSize; i++) {
        if (vect.IndexOf(i*10.1) != i)
          throw new Exception("IndexOf test " + i + " failed");
      }
      if (vect.IndexOf(200.1) != -1)
        throw new Exception("IndexOf non-existent test failed");
      if (dv.IndexOf(33.3) != 3)
        throw new Exception("IndexOf position test failed");

      // LastIndexOf() test
      for (int i=0; i<collectionSize; i++) {
        if (vect.LastIndexOf(i*10.1) != i)
          throw new Exception("LastIndexOf test " + i + " failed");
      }
      if (vect.LastIndexOf(200.1) != -1)
        throw new Exception("LastIndexOf non-existent test failed");
      if (dv.LastIndexOf(33.3) != 6)
        throw new Exception("LastIndexOf position test failed");

      // Copy constructor test
      DoubleVector dvCopy = new DoubleVector(dv);
      for (int i=0; i<doubleArray.Length; i++) {
        if (doubleArray[i] != dvCopy[i])
          throw new Exception("Copy constructor failed, index:" + i);
      }
    }
    {
      // Repeat() test
      try {
        myDoubleVector = DoubleVector.Repeat(77.7, -1);
        throw new Exception("Repeat negative count test failed");
      } catch (ArgumentOutOfRangeException) {
      }
      DoubleVector dv = DoubleVector.Repeat(77.7, 5);
      if (dv.Count != 5)
        throw new Exception("Repeat count test failed");
      
      // Also tests enumerator
      {
        System.Collections.IEnumerator myEnumerator = dv.GetEnumerator();
        while ( myEnumerator.MoveNext() ) {
           if ((double)myEnumerator.Current != 77.7)
             throw new Exception("Repeat (1) test failed");
        }
      }
      {
        System.Collections.Generic.IEnumerator<double> myEnumerator = dv.GetEnumerator();
        while ( myEnumerator.MoveNext() ) {
           if (myEnumerator.Current != 77.7)
             throw new Exception("Repeat (2) test failed");
        }
      }
    }

    {
      // InsertRange() test
      DoubleVector dvect = new DoubleVector();
      for (int i=0; i<5; i++) {
        dvect.Add(1000.0*i);
      }
      vect.InsertRange(midCollection, dvect);
      if (vect.Count != collectionSize+dvect.Count)
        throw new Exception("InsertRange test size failed");

      for (int i=0; i<midCollection; i++) {
        if (vect.IndexOf(i*10.1) != i)
          throw new Exception("InsertRange (1) test " + i + " failed");
      }
      for (int i=0; i<dvect.Count; i++) {
        if (vect[i+midCollection] != dvect[i])
          throw new Exception("InsertRange (2) test " + i + " failed");
      }
      for (int i=midCollection; i<collectionSize; i++) {
        if (vect.IndexOf(i*10.1) != i+dvect.Count)
          throw new Exception("InsertRange (3) test " + i + " failed");
      }
      try {
        vect.InsertRange(0, null);
        throw new Exception("InsertRange (4) test failed");
      } catch (ArgumentNullException) {
      }

      // RemoveRange() test
      vect.RemoveRange(0, 0);
      vect.RemoveRange(midCollection, dvect.Count);
      if (vect.Count != collectionSize)
        throw new Exception("RemoveRange test size failed");
      for (int i=0; i<collectionSize; i++) {
        if (vect.IndexOf(i*10.1) != i)
          throw new Exception("RemoveRange test " + i + " failed");
      }
      try {
        vect.RemoveRange(-1, 0);
        throw new Exception("RemoveRange index out of range (1) test failed");
      } catch (ArgumentOutOfRangeException) {
      }
      try {
        vect.RemoveRange(0, -1);
        throw new Exception("RemoveRange count out of range (2) test failed");
      } catch (ArgumentOutOfRangeException) {
      }
      try {
        vect.RemoveRange(collectionSize+1, 0);
        throw new Exception("RemoveRange index and count out of range (1) test failed");
      } catch (ArgumentException) {
      }
      try {
        vect.RemoveRange(0, collectionSize+1);
        throw new Exception("RemoveRange index and count out of range (2) test failed");
      } catch (ArgumentException) {
      }

      // AddRange() test
      vect.AddRange(dvect);
      if (vect.Count != collectionSize+dvect.Count)
        throw new Exception("AddRange test size failed");
      for (int i=0; i<collectionSize; i++) {
        if (vect.IndexOf(i*10.1) != i)
          throw new Exception("AddRange (1) test " + i + " failed");
      }
      for (int i=0; i<dvect.Count; i++) {
        if (vect[i+collectionSize] != dvect[i])
          throw new Exception("AddRange (2) test " + i + " failed");
      }
      try {
        vect.AddRange(null);
        throw new Exception("AddRange (3) test failed");
      } catch (ArgumentNullException) {
      }
      vect.RemoveRange(collectionSize, dvect.Count);

      // GetRange() test
      int rangeSize = 5;
      DoubleVector returnedVec = vect.GetRange(0, 0);
      returnedVec = vect.GetRange(midCollection, rangeSize);
      if (returnedVec.Count != rangeSize)
        throw new Exception("GetRange test size failed");
      for (int i=0; i<rangeSize; i++) {
        if (returnedVec.IndexOf((i+midCollection)*10.1) != i)
          throw new Exception("GetRange test " + i + " failed");
      }
      try {
        vect.GetRange(-1, 0);
        throw new Exception("GetRange index out of range (1) test failed");
      } catch (ArgumentOutOfRangeException) {
      }
      try {
        vect.GetRange(0, -1);
        throw new Exception("GetRange count out of range (2) test failed");
      } catch (ArgumentOutOfRangeException) {
      }
      try {
        vect.GetRange(collectionSize+1, 0);
        throw new Exception("GetRange index and count out of range (1) test failed");
      } catch (ArgumentException) {
      }
      try {
        vect.GetRange(0, collectionSize+1);
        throw new Exception("GetRange index and count out of range (2) test failed");
      } catch (ArgumentException) {
      }
      {
        StructVector inputvector = new StructVector();
        int arrayLen = 10;
        for (int i=0; i<arrayLen; i++) {
          inputvector.Add(new Struct(i/10.0));
        }
        StructVector outputvector = inputvector.GetRange(0,arrayLen);
        for(int i=0; i<arrayLen; i++) {
          if (outputvector[i].num != inputvector[i].num)
            throw new Exception("GetRange (1) test failed, i:" + i);
        }
        foreach (Struct s in inputvector) {
          s.num += 20.0;
        }
        for(int i=0; i<arrayLen; i++) {
          if (outputvector[i].num + 20.0 != inputvector[i].num )
            throw new Exception("GetRange (2) test failed (only a shallow copy was made), i:" + i);
        }
      }
    }

    // Insert() test
    int pos = 0;
    int count = vect.Count;
    vect.Insert(pos, -5.1);
    count++;
    if (vect.Count != count || vect[pos] != -5.1)
      throw new Exception("Insert at beginning test failed");

    pos = midCollection;
    vect.Insert(pos, 85.1);
    count++;
    if (vect.Count != count || vect[pos] != 85.1)
      throw new Exception("Insert at " + pos + " test failed");

    pos = vect.Count;
    vect.Insert(pos, 195.1);
    count++;
    if (vect.Count != count || vect[pos] != 195.1)
      throw new Exception("Insert at end test failed");

    pos = vect.Count+1;
    try {
      vect.Insert(pos, 222.1); // should throw
      throw new Exception("Insert after end (1) test failed");
    } catch (ArgumentOutOfRangeException) {
    }
    if (vect.Count != count)
      throw new Exception("Insert after end (2) test failed");

    pos = -1;
    try {
      vect.Insert(pos, 333.1); // should throw
      throw new Exception("Insert before start (1) test failed");
    } catch (ArgumentOutOfRangeException) {
    }
    if (vect.Count != count)
      throw new Exception("Insert before start (2) test failed");

    // Remove() test
    vect.Remove(195.1);
    count--;
    vect.Remove(-5.1);
    count--;
    vect.Remove(85.1);
    count--;
    vect.Remove(9999.1); // element does not exist, should quietly do nothing
    if (vect.Count != count)
      throw new Exception("Remove count check test failed");
    for (int i=0; i<collectionSize; i++) {
      if (vect[i] != i*10.1)
        throw new Exception("Remove test failed, index:" + i);
    }

    // RemoveAt() test
    vect.Insert(0, -4.1);
    vect.Insert(midCollection, 84.1);
    vect.Insert(vect.Count, 194.1);
    vect.RemoveAt(vect.Count-1);
    vect.RemoveAt(midCollection);
    vect.RemoveAt(0);
    try {
      vect.RemoveAt(-1);
      throw new Exception("RemoveAt test (1) failed");
    } catch (ArgumentOutOfRangeException) {
    }
    try {
      vect.RemoveAt(vect.Count);
      throw new Exception("RemoveAt test (2) failed");
    } catch (ArgumentOutOfRangeException) {
    }
    for (int i=0; i<collectionSize; i++) {
      if (vect[i] != i*10.1)
        throw new Exception("RemoveAt test (3) failed, index:" + i);
    }

    {
      // Capacity test
      try {
        myDoubleVector = new DoubleVector(-1);
        throw new Exception("constructor setting capacity (1) test failed");
      } catch (ArgumentOutOfRangeException) {
      }

      DoubleVector dv = new DoubleVector(10);
      if (dv.Capacity != 10 || dv.Count != 0)
        throw new Exception("constructor setting capacity (2) test failed");
      dv.Capacity = 20;
      if (dv.Capacity != 20)
        throw new Exception("capacity test (1) failed");
      dv.Add(1.11);
      try {
        dv.Capacity = dv.Count-1;
        throw new Exception("capacity test (2) failed");
      } catch (ArgumentOutOfRangeException) {
      }

      // SetRange() test
      for (int i=dv.Count; i<collectionSize; i++) {
        dv.Add(0.0);
      }
      dv.SetRange(0, vect);
      if (dv.Count != collectionSize)
        throw new Exception("SetRange count check test failed");
      for (int i=0; i<collectionSize; i++) {
        if (vect[i] != dv[i])
          throw new Exception("SetRange test (1) failed, index:" + i);
      }
      try {
        dv.SetRange(-1, vect);
        throw new Exception("SetRange test (2) failed");
      } catch (ArgumentOutOfRangeException) {
      }
      try {
        dv.SetRange(1, vect);
        throw new Exception("SetRange test (3) failed");
      } catch (ArgumentOutOfRangeException) {
      }
      try {
        vect.SetRange(0, null);
        throw new Exception("SetRange (4) test failed");
      } catch (ArgumentNullException) {
      }

      // Reverse() test
      dv.Reverse();
      for (int i=0; i<collectionSize; i++) {
        if (vect[i] != dv[collectionSize-i-1])
          throw new Exception("Reverse test (1) failed, index:" + i);
      }
      dv.Reverse(0, collectionSize);
      for (int i=0; i<collectionSize; i++) {
        if (vect[i] != dv[i])
          throw new Exception("Reverse test (2) failed, index:" + i);
      }
      dv.Reverse(0, 0); // should do nothing!
      for (int i=0; i<collectionSize; i++) {
        if (vect[i] != dv[i])
          throw new Exception("Reverse test (3) failed, index:" + i);
      }
      try {
        dv.Reverse(-1, 0);
        throw new Exception("Reverse test (4) failed");
      } catch (ArgumentOutOfRangeException) {
      }
      try {
        dv.Reverse(0, -1);
        throw new Exception("Reverse test (5) failed");
      } catch (ArgumentOutOfRangeException) {
      }
      try {
        dv.Reverse(collectionSize+1, 0);
        throw new Exception("Reverse test (6) failed");
      } catch (ArgumentException) {
      }
      try {
        dv.Reverse(0, collectionSize+1);
        throw new Exception("Reverse test (7) failed");
      } catch (ArgumentException) {
      }
    }

    // foreach test
    {
      int index=0;
      foreach (double s in vect) {
        if (s != index*10.1)
          throw new Exception("foreach test failed, index:" + index);
        index++;
      }
    }

    // Clear() test
    vect.Clear();
    if (vect.Count != 0)
      throw new Exception("Clear failed");

    // Finally test the methods being wrapped
    {
      IntVector iv = new IntVector();
      for (int i=0; i<4; i++) {
        iv.Add(i);
      }

      double x = li_std_vector.average(iv);
      x += li_std_vector.average( new IntVector( new int[] {1, 2, 3, 4} ) );
      myRealVector = li_std_vector.half( new RealVector( new float[] {10F, 10.5F, 11F, 11.5F} ) );

      DoubleVector dvec = new DoubleVector();
      for (int i=0; i<10; i++) {
        dvec.Add(i/2.0);
      }
      li_std_vector.halve_in_place(dvec);
    }

    // Dispose()
    {
      using (StructVector vs = new StructVector( new Struct[] { new Struct(0.0), new Struct(11.1) } ) )
      using (DoubleVector vd = new DoubleVector( new double[] { 0.0, 11.1 } ) ) {
      }
    }

    // More wrapped methods
    {
      RealVector v0 = li_std_vector.vecreal(new RealVector());
      float flo = 123.456f;
      v0.Add(flo);
      flo = v0[0];

      IntVector v1 = li_std_vector.vecintptr(new IntVector());
      IntPtrVector v2 = li_std_vector.vecintptr(new IntPtrVector());
      IntConstPtrVector v3 = li_std_vector.vecintconstptr(new IntConstPtrVector());

      v1.Add(123);
      v2.Clear();
      v3.Clear();

      StructVector v4 = li_std_vector.vecstruct(new StructVector());
      StructPtrVector v5 = li_std_vector.vecstructptr(new StructPtrVector());
      StructConstPtrVector v6 = li_std_vector.vecstructconstptr(new StructConstPtrVector());

      v4.Add(new Struct(123));
      v5.Add(new Struct(123));
      v6.Add(new Struct(123));
    }

    // Test vectors of pointers
    {
      StructPtrVector inputvector = new StructPtrVector();
      int arrayLen = 10;
      for (int i=0; i<arrayLen; i++) {
        inputvector.Add(new Struct(i/10.0));
      }
      Struct[] outputarray = new Struct[arrayLen];
      inputvector.CopyTo(outputarray);
      for(int i=0; i<arrayLen; i++) {
        if (outputarray[i].num != inputvector[i].num)
          throw new Exception("StructPtrVector test (1) failed, i:" + i);
      }
      foreach (Struct s in inputvector) {
        s.num += 20.0;
      }
      for(int i=0; i<arrayLen; i++) {
        if (outputarray[i].num != 20.0 + i/10.0)
          throw new Exception("StructPtrVector test (2) failed (a deep copy was incorrectly made), i:" + i);
      }

      int rangeSize = 5;
      int mid = arrayLen/2;
      StructPtrVector returnedVec = inputvector.GetRange(mid, rangeSize);
      for (int i=0; i<rangeSize; i++) {
        if (inputvector[i+mid].num != returnedVec[i].num)
          throw new Exception("StructPtrVector test (3) failed, i:" + i);
      }
    }

    // Test vectors of const pointers
    {
      StructConstPtrVector inputvector = new StructConstPtrVector();
      int arrayLen = 10;
      for (int i=0; i<arrayLen; i++) {
        inputvector.Add(new Struct(i/10.0));
      }
      Struct[] outputarray = new Struct[arrayLen];
      inputvector.CopyTo(outputarray);
      for(int i=0; i<arrayLen; i++) {
        if (outputarray[i].num != inputvector[i].num)
          throw new Exception("StructConstPtrVector test (1) failed, i:" + i);
      }
      foreach (Struct s in inputvector) {
        s.num += 20.0;
      }
      for(int i=0; i<arrayLen; i++) {
        if (outputarray[i].num != 20.0 + i/10.0)
          throw new Exception("StructConstPtrVector test (2) failed (a deep copy was incorrectly made), i:" + i);
      }

      int rangeSize = 5;
      int mid = arrayLen/2;
      StructConstPtrVector returnedVec = inputvector.GetRange(mid, rangeSize);
      for (int i=0; i<rangeSize; i++) {
        if (inputvector[i+mid].num != returnedVec[i].num)
          throw new Exception("StructConstPtrVector test (3) failed, i:" + i);
      }
    }

  }
コード例 #30
0
 public IntVector(IntVector other) : this(SharpMochaPINVOKE.new_IntVector__SWIG_1(IntVector.getCPtr(other)), true)
 {
     if (SharpMochaPINVOKE.SWIGPendingException.Pending)
     {
         throw SharpMochaPINVOKE.SWIGPendingException.Retrieve();
     }
 }
コード例 #31
0
ファイル: Vector.cs プロジェクト: kisgal/libTISCH2.0withdepth
 public IntVector round() {
   IntVector ret = new IntVector(libtischPINVOKE.Vector_round(swigCPtr), true);
   if (libtischPINVOKE.SWIGPendingException.Pending) throw libtischPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
コード例 #32
0
 /// <summary>
 /// Get coordinates from a given direction
 /// </summary>
 /// <returns></returns>
 private IntVector GetCoordinateFromDirection(IntVector pol, IntVector direction)
 {
     return(new IntVector(direction.X + pol.X, pol.Y - direction.Y));
 }
コード例 #33
0
ファイル: MainWindow.xaml.cs プロジェクト: tomba/dwarrowdelf
        void MainWindow_KeyDown(object sender, KeyEventArgs e)
        {
            IntVector v;

            switch (e.Key)
            {
                case Key.Up: v = new IntVector(0, 1); break;
                case Key.Down: v = new IntVector(0, -1); break;
                case Key.Left: v = new IntVector(-1, 0); break;
                case Key.Right: v = new IntVector(1, 0); break;
                case Key.Add:
                    tileControl.TileSize += 1;
                    return;

                case Key.Subtract:
                    tileControl.TileSize -= 1;
                    return;

                default:
                    var diff = new IntVector(-10, -10);

                    var anim2 = new PointAnimation(tileControl.CenterPos - new Vector(diff.X, diff.Y), new Duration(TimeSpan.FromMilliseconds(2000)));
                    this.BeginAnimation(TileControlD3D.CenterPosProperty, anim2);

                    return;
            }

            //this.CenterPos += (v * 4);
            tileControl.CenterPos += new Vector(v.X, v.Y) / 10;
        }
コード例 #34
0
 public abstract bool isOn(IntVector origin);
コード例 #35
0
ファイル: IntList.cs プロジェクト: Staskkk/VRPhone
 public IntList(IntVector other) : this(solar_api_solver_mapPINVOKE.new_IntList__SWIG_1(IntVector.getCPtr(other)), true)
 {
     if (solar_api_solver_mapPINVOKE.SWIGPendingException.Pending)
     {
         throw solar_api_solver_mapPINVOKE.SWIGPendingException.Retrieve();
     }
 }
コード例 #36
0
 public SetItemResult <T> Set(IntVector position, T item)
 {
     return(Grid.Set(CoordinateSystem.Normalize(position), item));
 }
コード例 #37
0
 bool ContainsWall2D(HashSet <IntVector> walls, HashSet <IntVector> doors, IntVector position)
 {
     return(walls.Contains(position) || doors.Contains(position));
 }
コード例 #38
0
ファイル: IMapFilter.cs プロジェクト: Staskkk/VRPhone
 public virtual void filter(Transform3Df pose1, Transform3Df pose2, CloudPointVector input, CloudPointVector output, IntVector index)
 {
     solar_api_solver_mapPINVOKE.IMapFilter_filter__SWIG_1(swigCPtr, Transform3Df.getCPtr(pose1), Transform3Df.getCPtr(pose2), CloudPointVector.getCPtr(input), CloudPointVector.getCPtr(output), IntVector.getCPtr(index));
     if (solar_api_solver_mapPINVOKE.SWIGPendingException.Pending)
     {
         throw solar_api_solver_mapPINVOKE.SWIGPendingException.Retrieve();
     }
 }
コード例 #39
0
        bool HasValidCornerNeighbors(HashSet <IntVector> walls, HashSet <IntVector> doors, IntVector center, int dx1, int dz1, int dx2, int dz2)
        {
            var d1    = new IntVector(dx1, 0, dz1);
            var d2    = new IntVector(dx2, 0, dz2);
            var pos1  = center + d1;
            var pos2  = center + d2;
            var pos12 = center + d1 + d2;

            return(ContainsWall2D(walls, doors, pos1) && ContainsWall2D(walls, doors, pos2) && !ContainsWall2D(walls, doors, pos12));
        }
コード例 #40
0
        public byte[,] GenerateMaze()
        {
            if (_isUsed)
            {
                throw new Exception("You cannot use this class again!");
            }

            _isUsed = true;

            // Generate initial cell
            var randX = _mazeGenParams.StartCellX ?? _random.Next(_mazeGenParams.XSize);
            var randY = _mazeGenParams.StartCellX ?? _random.Next(_mazeGenParams.YSize);

            _openedCells.Add(new IntVector(randX * 2 + 1, randY * 2 + 1));
            _maze[_openedCells[0].X, _openedCells[0].Y] = 1;


            while (_openedCells.Count > 0)
            {
                var cell       = GetNextCell();
                var neighbours = GetNeighbours(cell);
                if (neighbours.Count == 0)
                {
                    _openedCells.Remove(cell);
                    continue;
                }
                BreakNeighbour(neighbours, _random.Next(neighbours.Count));
            }

            var noWallsCount = 0;

            for (var i = 0; i < _maze.GetLength(1); i++)
            {
                for (var j = 0; j < _maze.GetLength(0); j++)
                {
                    if (_maze[j, i] == 1)
                    {
                        noWallsCount++;
                    }
                }
            }

            Console.WriteLine("Count is: " + noWallsCount * _mazeGenParams.CavernRate / MazeConfig.MazeMaxCavernRate);
            Console.WriteLine("Max level is: " + (_rootedMazeSize / 5 * 2 + 1));
            for (var c = 0; c < 1f * noWallsCount * _mazeGenParams.CavernRate / MazeConfig.MazeMaxCavernRate; c++)
            {
                var initialCell = new IntVector(_random.Next(_mazeGenParams.XSize) * 2 + 1, _random.Next(_mazeGenParams.YSize) * 2 + 1);

                var levels     = _random.Next(1 + _rootedMazeSize / 5) * 2 + 1;
                var breakCells = new List <IntVector> {
                    initialCell
                };
                for (var l = 0; l < levels; l++)
                {
                    var nextBreakCells = new List <IntVector>();
                    foreach (var breakCell in breakCells)
                    {
                        foreach (var shift in IntVector.OrtNormals)
                        {
                            var nei = breakCell + shift;
                            if (GetCell(nei) == 0)
                            {
                                _maze[nei.X, nei.Y] = Passable;
                                nextBreakCells.Add(nei);
                            }
                        }
                    }

                    breakCells = nextBreakCells;
                }
            }

            return(_maze);
        }
コード例 #41
0
ファイル: IntVector.cs プロジェクト: Anshul-Bansal/gsoc
 internal static HandleRef getCPtr(IntVector obj)
 {
     return((obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr);
 }
コード例 #42
0
ファイル: Character.cs プロジェクト: gpljr/BlockTileSystem
    private void Move()
    {
        //play move animaition

        AudioSource.PlayClipAtPoint(_audioMove, CameraControl.cameraLoc, LevelCode.audioVolume);
        if (LevelCode.levelType == LevelType.Separation || LevelCode.levelType == LevelType.Merging)
        {
            switch (_direction)
            {
            case Direction.North:
                _worldEntity.SetBoolAnimationParameter("MoveUpSlow", true);
                break;

            case Direction.South:
                _worldEntity.SetBoolAnimationParameter("MoveDownSlow", true);
                break;

            case Direction.West:
                _worldEntity.SetBoolAnimationParameter("MoveLeftSlow", true);
                break;

            case Direction.East:
                _worldEntity.SetBoolAnimationParameter("MoveRightSlow", true);
                break;
            }
        }
        else
        {
            switch (_direction)
            {
            case Direction.North:
                _worldEntity.SetBoolAnimationParameter("MoveUp", true);
                break;

            case Direction.South:
                _worldEntity.SetBoolAnimationParameter("MoveDown", true);
                break;

            case Direction.West:
                _worldEntity.SetBoolAnimationParameter("MoveLeft", true);
                break;

            case Direction.East:
                _worldEntity.SetBoolAnimationParameter("MoveRight", true);
                break;
            }
        }

        IntVector vec = _worldEntity.Location;

        if (_input.x != 0)
        {
            vec.x   += _input.x;
            _input.x = 0;
        }
        else if (_input.y != 0)
        {
            vec.y   += _input.y;
            _input.y = 0;
        }
        _worldEntity.Location = vec;
    }
コード例 #43
0
        protected override Function BuildNetwork(Variable input, DeviceDescriptor device, string name)
        {
            var c1 = UnityCNTK.Layers.Dense(input, HiddenSize, device, true, name + ".Dense", InitialWeightScale);

            resultOutput   = CNTKLib.Slice(c1, AxisVector.Repeat(new Axis(0), 1), IntVector.Repeat(0, 1), IntVector.Repeat(HiddenSize - 1, 1));
            varianceOutput = CNTKLib.Square(CNTKLib.Slice(c1, AxisVector.Repeat(new Axis(0), 1), IntVector.Repeat(HiddenSize - 1, 1), IntVector.Repeat(HiddenSize, 1)));
            targetInput    = CNTKLib.InputVariable(resultOutput.Shape, resultOutput.DataType, name + ".TargetInput");

            var squareErrorRoot = CNTKLib.Sqrt(CNTKLib.SquaredError(resultOutput, targetInput));
            var l = CNTKLib.ElementDivide(squareErrorRoot, CNTKLib.ElementTimes(Constant.Scalar(DataType.Float, 2), varianceOutput));

            lossOutput = l.Output + CNTKLib.ElementTimes(CNTKLib.Log(varianceOutput), Constant.Scalar(DataType.Float, 1));
            //lossOutput = squareError;//test

            //add parameters to list
            ParameterNames.Add(ParamTypeToName(DenseParamType.Weight));
            ParameterNames.Add(ParamTypeToName(DenseParamType.Bias));

            return(lossOutput);
        }
コード例 #44
0
ファイル: Move.cs プロジェクト: snowhork/dungeon
 public Move(IntTransform intTransform, MapInfo mapInfo, IntVector direction) : base(intTransform, mapInfo)
 {
     _direction = direction;
 }
コード例 #45
0
ファイル: IntVector.cs プロジェクト: x-xing/Quantlib-SWIG
 public IntVector(IntVector other) : this(NQuantLibcPINVOKE.new_IntVector__SWIG_1(IntVector.getCPtr(other)), true)
 {
     if (NQuantLibcPINVOKE.SWIGPendingException.Pending)
     {
         throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
     }
 }
コード例 #46
0
 public BlockInWorld(TBlock obj, Grid grid, IntVector position)
 {
     Object = obj ?? throw new ArgumentNullException(nameof(obj));
     Grid   = grid ?? throw new ArgumentNullException(nameof(grid));
     Bounds = IntRectangle.FromPositionAndSize(position, Constants.BlockSizeVector);
 }
コード例 #47
0
 ///<summary>Converts an IntVector value to a string, in the form 'X= Y= Z='</summary>
 public static string Conv_IntVectorToString(IntVector InIntVec) =>
 KismetStringLibrary_methods.Conv_IntVectorToString_method.Invoke(InIntVec);
コード例 #48
0
ファイル: AIPlayer.cs プロジェクト: Blueteak/MazeWar
	void MoveOnPath()
	{
		if(mCD <= 0)
		{	
			if(interm == Direction.up)
			{
				//Debug.Log("Moving Forward");
				control.CmdDoMovement(true, false ,false, false);
				interm = Direction.wait;
				if(following)
					mCD = MoveSpeed/2f;
				else
					mCD =  MoveSpeed;
			}
			else if(MoveQ.Count > 0)
			{
				Direction d = MoveQ.Pop();
				if(d == getDirection()) //Move Forward
				{
					//Debug.Log(MoveQ.Count + "| Dir to Move: " + d + " - Facing: " + getDirection() + " - Moving Forward");
					control.CmdDoMovement(true, false ,false, false);
					if(following)
						mCD = MoveSpeed/2f;
					else
						mCD =  MoveSpeed;
				}
				else if(d == Direction.wait)
				{
					mCD = Random.Range(mCD/2, mCD);
				}
				else if(reverse(d, getDirection()))
				{
					//Debug.Log(MoveQ.Count + "| Dir to Move: " + d + " - Facing: " + getDirection() + " - Turning Around");
					control.CmdDoMovement(false, false ,true, false);
					control.CmdDoMovement(false, false ,true, false);
					interm = Direction.up;
					if(following)
						mCD = MoveSpeed/2f;
					else
						mCD =  MoveSpeed/3.5f;
				}
				else
				{
					if(leftTurn(getDirection(), d)) //Turn left
					{
						//Debug.Log(MoveQ.Count + "| Dir to Move: " + d + " - Facing: " + getDirection() + " - Turning Left");
						control.CmdDoMovement(false, false ,true, false);
						interm = Direction.up;
						if(following)
							mCD = MoveSpeed/2f;
						else
							mCD =  MoveSpeed/3.5f;
					}
					else //Turn right
					{
						//Debug.Log(MoveQ.Count + "| Dir to Move: " + d + " - Facing: " + getDirection() + " - Turning Right");
						control.CmdDoMovement(false, false ,false, true);
						interm = Direction.up;
						if(following)
							mCD = MoveSpeed/2f;
						else
							mCD =  MoveSpeed/3.5f;
					}
				}
			}
			else
			{
				if(following)
				{
					following = false;
					Debug.Log("Ended follow (lost or killed)");
				}
				hasPath = false;
				wantPos = randomPos();
				mCD =  MoveSpeed/2;
			}

		}
		else
			mCD -= Time.deltaTime;
	}
コード例 #49
0
 ///<summary>
 ///Converts an IntVector->string, creating a new string in the form AppendTo+Prefix+InIntVector+Suffix
 ///@
 ///</summary>
 ///<remarks>
 ///param AppendTo - An existing string to use as the start of the conversion string
 ///@param Prefix - A string to use as a prefix, after the AppendTo string
 ///@param InIntVector - The intVector value to convert. Uses the standard FVector::ToString conversion
 ///@param Suffix - A suffix to append to the end of the conversion string
 ///@return A new string built from the passed parameters
 ///</remarks>
 public static string BuildString_IntVector(string AppendTo, string Prefix, IntVector InIntVector, string Suffix) =>
 KismetStringLibrary_methods.BuildString_IntVector_method.Invoke(AppendTo, Prefix, InIntVector, Suffix);
コード例 #50
0
 public override bool isOn(IntVector origin)
 {
     return(false);
 }
コード例 #51
0
ファイル: IntVectorFixture.cs プロジェクト: Kasmatos/Training
 public void EmptyVectorMustHaveSizeOfZero()
 {
     var v = new IntVector(10);
     Assert.AreEqual(0, v.Size);
 }