Exemplo n.º 1
0
    void OnGUI()
    {
        if (GUI.Button(new Rect(Screen.width / 2 - 40, Screen.height / 2, 200, 30), "Create Worker"))
        {
            if (resources >= 50)
            {
                GameObject worker = PoolManager.Instance.GetObjectForType("WorkerBee", false);
                WorkerBee  script = worker.GetComponent <WorkerBee>();
                script.transform.position = new Vector3(-5.5f, 0, 0);
                resources -= 50;
            }
            else
            {
                string message = ("There is not enough minerals");
                GUI.Label(new Rect(Screen.width / 2, Screen.height / 2, 200f, 200f), message);
                print(message);
            }
        }

        /*
         * if (GUI.Button(new Rect(Screen.width / 2 - 150, Screen.height / 1.5f, 300, 30), "buildthat"))
         * {
         *
         *
         * }
         */
    }
Exemplo n.º 2
0
        public ActionResult DeleteConfirmed(int id)
        {
            WorkerBee workerBee = db.WorkerBees.Find(id);

            db.WorkerBees.Remove(workerBee);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 3
0
        public void WorkerDeadTest()
        {
            ///This test is to check if the worker is not still alive after 40 damage.
            WorkerBee bee1 = new WorkerBee();

            bee1.Damage(40);
            Assert.AreEqual(true, bee1.IsDead);
        }
Exemplo n.º 4
0
        public void WorkerAliveTest()
        {
            //This test is to check if the worker is still alive after 10 damage.
            WorkerBee bee1 = new WorkerBee();

            bee1.Damage(10);
            Assert.AreEqual(false, bee1.IsDead);
        }
        public void WhenAWorkerBeeIsCreated_ItsHealthIsOneHundred()
        {
            // Arrange
            var workerBee = new WorkerBee();

            // Assert
            Assert.AreEqual(100, workerBee.Health);
        }
        public void WhenAWorkerBeeIsCreated_ItIsAlive()
        {
            // Arrange
            var workerBee = new WorkerBee();

            // Assert
            Assert.IsFalse(workerBee.IsDead);
        }
Exemplo n.º 7
0
 public ActionResult Edit([Bind(Include = "ID,Name,JoinDate,Age,ZipCode")] WorkerBee workerBee)
 {
     if (ModelState.IsValid)
     {
         db.Entry(workerBee).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(workerBee));
 }
        public void DeathTest1()
        {
            int       damageAmount = 31;
            WorkerBee bee          = new WorkerBee();

            bee.Damage(damageAmount);
            Assert.AreEqual(bee.Health, 69);
            bee.Damage(damageAmount);
            Assert.AreEqual(bee.Health, 69);
        }
        public void TestGetTotalSalaray()
        {
            var workerbee = new WorkerBee("workerbee");
            var boss      = new Boss("boss");
            var employees = new Employee[2] {
                boss, workerbee
            };
            var employeeManager = new EmployeeManager();

            Assert.AreEqual(employeeManager.GetTotalSalary(employees), 11);
        }
        public void WhenDamagingAWorkerBeeForThirtyPercent_ItIsAlive()
        {
            // Arrange
            var workerBee = new WorkerBee();

            // Act
            workerBee.Damage(30);

            // Assert
            Assert.IsFalse(workerBee.IsDead);
        }
Exemplo n.º 11
0
        public ActionResult Create([Bind(Include = "ID,Name,JoinDate,Age,ZipCode")] WorkerBee workerBee)
        {
            if (ModelState.IsValid)
            {
                db.WorkerBees.Add(workerBee);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(workerBee));
        }
        public void WhenDamagingAWorkerBeeForThirtyOne_ItIsDead()
        {
            // Arrange
            var workerBee = new WorkerBee();

            // Act
            workerBee.Damage(31);

            // Assert
            Assert.IsTrue(workerBee.IsDead);
        }
        public void WhenConvertingAWorkerBeeToTypeString_CorrectStringIsReturned()
        {
            // Arrange
            var bee       = new WorkerBee();
            var converter = new BeeTypeToStringConverter();

            // Act
            var beeTypeString = converter.Convert(bee, null, null, null);

            // Assert
            Assert.AreEqual("Worker Bee", beeTypeString);
        }
Exemplo n.º 14
0
        // GET: WorkerBees/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            WorkerBee workerBee = db.WorkerBees.Find(id);

            if (workerBee == null)
            {
                return(HttpNotFound());
            }
            return(View(workerBee));
        }
Exemplo n.º 15
0
        public bool CreateBees(WorkerBeeCreate model)
        {
            var entity = new WorkerBee()
            {
                OwnerId        = _userId,
                OriginLocation = model.OriginLocation,
                OriginDate     = model.OriginDate,
            };

            using (var ctx = new ApplicationDbContext())
            {
                ctx.WorkerBees.Add(entity);
                return(ctx.SaveChanges() == 1);
            }
        }
        public void WorkerBee_GetSingleHoney()
        {
            WorkerBee bee = new WorkerBee(BeeWorkingState.OnTheRest);

            int honey = 0;

            DateTime        now   = DateTime.Now;
            List <TimeSpan> spans = new List <TimeSpan>();

            bee.ActionPerformed += (sender, args) =>
            {
                if (args.ActionType == BeeActionType.EnterBeehiveWithHoney)
                {
                    spans.Add(DateTime.Now - now);
                    now = DateTime.Now;

                    Interlocked.Increment(ref honey);
                }
            };

            bee.RequestForBeehiveData += (sender, args) =>
            {
                if (args.RequestType == BeeRequestType.RequestToEnterBeehive)
                {
                    args.Succeed = true;
                }
            };

            TimeSpan timeToHarvestOneBee = this.apiaryBalance.WorkerBalance.TimeToHarvestHoney
                                           + this.apiaryBalance.WorkerBalance.TimeToRestInBeehive
                                           + this.apiaryBalance.GuardBalance.TimeToCheckOneBee;

            bee.StartWork();

            Task.Delay((int)timeToHarvestOneBee.TotalMilliseconds * 5)
            .GetAwaiter().GetResult();

            Assert.AreEqual(5, honey);
            bee.StopWork();
        }
Exemplo n.º 17
0
 // Use this for initialization
 void Start()
 {
     worker = GetComponentInParent <WorkerBee>();
 }
Exemplo n.º 18
0
 void Start()
 {
     nectarTextContainer.enabled = false;
     bee = GetComponent <WorkerBee>();
 }
Exemplo n.º 19
0
    static void Main(string[] args)
    {
        var workerBee = new WorkerBee();

        workerBee.ImDoingWorkReally();
    }
Exemplo n.º 20
0
        public void HealthThreshold_DefaultsTo70()
        {
            var bee = new WorkerBee();

            Assert.AreEqual(70, bee.HealthThreshold);
        }
Exemplo n.º 21
0
 void Start()
 {
     bee = GetComponent <WorkerBee>();
 }
Exemplo n.º 22
0
 public void Setup()
 {
     _workerBee = new WorkerBee();
     _droneBee  = new DroneBee();
     _queenBee  = new QueenBee();
 }