Ejemplo n.º 1
0
        public void TestMethod1()
        {
            int res      = SumMethod.Sum(new int[] { 4, 0, 3, 19, 492, -10, 1 });
            int expected = -10;

            Assert.AreEqual(expected, res, 0.001, "Wrong result");
        }
Ejemplo n.º 2
0
    //End of behaviour methods
    //A lot of the variables here should be loaded into an ini file, for customisation
    public SteeringBehaviour(AIEntity own)
    {
        this.owner = own;
        entityFlags = 0;
        boxLength = 5;
        weightEvade = 0.5;
        weightPursuit = 0.5;
        weightArrive = 0.5;
        weightFlee = 0.5;
        weightSeek = 0.5;
        weightWander = 0.5;
        weightWallAvoidance = 0.5;
        weightObstacleAvoidance = 0.5;
        useCellPartitioning = false;
        numberOfFeelers = 3;
        summingMethod = SumMethod.priority;
        wanderDist = SteeringBehaviour.wanderDistance;
        wanderRad = SteeringBehaviour.wanderRadius;
        wanderJit = SteeringBehaviour.wanderJitter;
        currentAccel = AccelerationType.medium;
        waypointSeekDistance = 5;
        entityViewDistance = 10;
        feelersForWall = new Vector[3];

        double sigma = UnityEngine.Random.Range(0.0f, 180.0f)*3.14;
        wanderTarget = new Vector(wanderDist*Mathf.Cos((float)sigma), wanderDist*Mathf.Sin((float)sigma));

        //Set the path data here, when the class has been made.
    }
Ejemplo n.º 3
0
        public TemplateSumContext(int Cols)
        {
            var methods = new UserMethod[1];

            this.MethodList = methods;
            CalcMethod      = new SumMethod(this, Cols);
            methods[0]      = CalcMethod;
        }
Ejemplo n.º 4
0
        public void SumUp1() //with empty list
        {
            List <int> testList = new List <int>();

            int result = SumMethod.SumUp(testList);

            Assert.AreEqual(0, result);
        }
Ejemplo n.º 5
0
        public void SumUp2() //with single element
        {
            List <int> testList = new List <int>()
            {
                48
            };

            int result = SumMethod.SumUp(testList);

            Assert.AreEqual(48, result);
        }
Ejemplo n.º 6
0
        public void SumUp0() //with multiple elements
        {
            List <int> testList = new List <int>()
            {
                3, 6, 9, 8
            };

            int result = SumMethod.SumUp(testList);

            Assert.AreEqual(26, result);
        }
Ejemplo n.º 7
0
 public SteeringBehavior(FlyingEntity agent)
 {
     _flyingEntity    = agent;
     TargetAgent1     = null;
     TargetAgent2     = null;
     decelerationRate = DecelerationRate.NORMAL;
     SummingMethod    = SumMethod.WEIGHTED_AVG;
     _path            = new Path
     {
         Looped = true
     };
 }