Exemplo n.º 1
0
 public SleepAct()
 {
     Name         = "Sleep";
     RechargeRate = 1.0f;
     Teleport     = false;
     Type         = SleepType.Sleep;
 }
Exemplo n.º 2
0
        public ActionResult DeleteConfirmed(int id)
        {
            SleepType sleepType = db.SleepTypes.Find(id);

            db.SleepTypes.Remove(sleepType);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 3
0
 public SleepAct(CreatureAI creature) :
     base(creature)
 {
     Name         = "Sleep";
     RechargeRate = 1.0f;
     Teleport     = false;
     Type         = SleepType.Sleep;
 }
Exemplo n.º 4
0
 public SleepEventSequenceItem(JObject json) : base(json)
 {
     dynamic rawSequence = (dynamic)json;
     
     SequenceType = rawSequence.SequenceType;
     SleepTime = rawSequence.SleepTime;
     DayId = rawSequence.DayId;
     SleepType = rawSequence.SleepType;
 }
Exemplo n.º 5
0
        public SleepEventSequenceItem(JObject json) : base(json)
        {
            dynamic rawSequence = (dynamic)json;

            SequenceType = rawSequence.SequenceType;
            SleepTime    = rawSequence.SleepTime;
            DayId        = rawSequence.DayId;
            SleepType    = rawSequence.SleepType;
        }
Exemplo n.º 6
0
 public ActionResult Edit([Bind(Include = "SleepTypeID,Description")] SleepType sleepType)
 {
     if (ModelState.IsValid)
     {
         db.Entry(sleepType).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(sleepType));
 }
Exemplo n.º 7
0
        public StatusType Sleep(ref SIFHeaderType SIFHeader, SleepType Sleep1)
        {
            SleepRequest inValue = new SleepRequest();

            inValue.SIFHeader = SIFHeader;
            inValue.Sleep     = Sleep1;
            PongResponse retVal = ((IptFlowControl)(this)).Sleep(inValue);

            SIFHeader = retVal.SIFHeader;
            return(retVal.Status);
        }
Exemplo n.º 8
0
        public ActionResult Create([Bind(Include = "SleepTypeID,Description")] SleepType sleepType)
        {
            if (ModelState.IsValid)
            {
                db.SleepTypes.Add(sleepType);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(sleepType));
        }
Exemplo n.º 9
0
        // GET: SleepTypes/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            SleepType sleepType = db.SleepTypes.Find(id);

            if (sleepType == null)
            {
                return(HttpNotFound());
            }
            return(View(sleepType));
        }
Exemplo n.º 10
0
        private SleepType GetSleepType(byte type)
        {
            SleepType sleepType = SleepType.ExitSleep;

            if (type == 0)
            {
                sleepType = SleepType.ExitSleep;
                UpdateStateHandler?.Invoke();
            }
            else if (type == 1)
            {
                sleepType = SleepType.ClearTime;
            }
            return(sleepType);
        }
Exemplo n.º 11
0
 public override bool Decode(byte[] buf)
 {
     if (this.Decode(message, buf, out parameter))
     {
         byte cmdType = parameter[0];
         _c78.R    = 0x01;
         _c78.M    = this.message;
         SleepType = GetSleepType(cmdType);
         return(true);
     }
     else
     {
         return(false);
     }
 }
Exemplo n.º 12
0
 /// <summary>
 /// Assigns measurement and measurement type.
 /// </summary>
 /// <param name="measurement"></param>
 /// <param name="measurementType"></param>
 internal void AssignMeasurement(double?measurement, SleepType measurementType)
 {
     if (measurement.HasValue)
     {
         //A non null value is being assigned for this type
         _measurement     = measurement;
         _measurementType = measurementType;
     }
     else if ((measurement.HasValue == false) && (_measurementType == measurementType))
     {
         //The measurements are being cleared.
         _measurement     = null;
         _measurementType = null;
     }
 }
Exemplo n.º 13
0
        public static SleepStrategy Get(SleepType type)
        {
            switch (type)
            {
            case SleepType.Constant:
                return(Constant);

            case SleepType.Exponential:
                return(Exponential);

            case SleepType.Linear:
                return(Linear);

            default:
                throw new NotSupportedException($"Unspported sleep type {type}");
            }
        }
Exemplo n.º 14
0
    public void DoSleep(SleepType sleep)
    {
        Debug.Log("sleep " + sleep);
        switch (sleep)
        {
        case SleepType.none:
            return;

        case SleepType.terrible:
            HP      = Mathf.Clamp(HP + (int)(maxHP * 0.1), HP, maxHP);
            stamina = Mathf.Clamp(stamina - 2, 1, maxStamina);
            return;

        case SleepType.bad:
            HP      = Mathf.Clamp(HP + (int)(maxHP * 0.2), HP, maxHP);
            stamina = Mathf.Clamp(stamina, stamina, maxStamina);
            return;

        case SleepType.normal:
            HP      = Mathf.Clamp(HP + (int)(maxHP * 0.3), HP, maxHP);
            stamina = Mathf.Clamp(stamina + (int)(maxStamina * 0.5), 1, maxStamina);
            return;

        case SleepType.good:
            HP      = Mathf.Clamp(HP + (int)(maxHP * 0.4), HP, maxHP);
            stamina = Mathf.Clamp(stamina + (int)(maxStamina * 0.75), 1, maxStamina);
            return;

        case SleepType.great:
            HP      = Mathf.Clamp(HP + (int)(maxHP * 0.5), HP, maxHP);
            stamina = Mathf.Clamp(stamina + (int)(maxStamina * 1), 1, maxStamina);
            return;

        default:
            return;
        }
    }
Exemplo n.º 15
0
 public SleepRequest(SIFHeaderType SIFHeader, SleepType Sleep)
 {
     this.SIFHeader = SIFHeader;
     this.Sleep = Sleep;
 }
Exemplo n.º 16
0
 public C2D()
 {
     this.message = 0x2D;
     SleepType    = SleepType.ExitSleep;
 }
Exemplo n.º 17
0
 public SleepRequest(SIFHeaderType SIFHeader, SleepType Sleep)
 {
     this.SIFHeader = SIFHeader;
     this.Sleep     = Sleep;
 }
Exemplo n.º 18
0
    public void Init(int id)
    {
        alive   = true;
        this.id = id;
        float randomAngle    = Random.value * Mathf.PI * 2;
        float randomDistance = Random.value * Mathf.PI;
        float rd             = Mathf.Sin(randomDistance) * .5f + (Catager.catAmmount / 500) + .5f;

        if (rd < .2)
        {
            rd = .2f;
        }

        if (rd > 1.8f)
        {
            rd = 1.8f;
        }

        rd *= Random.value;

        if (Mathf.Round(Random.value * 8) == 0)
        {
            rd *= 4;
        }

        GOAL_X = Mathf.Cos(randomAngle) * rd;
        GOAL_Z = Mathf.Sin(randomAngle) * rd;

        position     = transform.localPosition;
        catX         = position.x;
        catY         = position.y;
        catZ         = position.z;
        realPosition = transform.localPosition;
        rotation     = transform.localEulerAngles;

        float randomVal = Random.value;
        float range     = randomVal * (DISTRACTION_END - DISTRACTION_START);

        timeUntilNextCatDistraction = -1;// DISTRACTION_START + range;

        float speedRange = Random.value * (SPEED_RANGE_END - SPEED_RANGE_START);

        speed = SPEED_RANGE_START + speedRange;

        if (Mathf.Round(Random.value * 2) < Mathf.Epsilon)
        {
            sleepType = SleepType.ON_BELLY;
        }
        else
        {
            sleepType = SleepType.SIDEWAYS;
        }


        float xDif  = catX - GOAL_X;
        float yDif  = catZ - GOAL_Z;
        float angle = Mathf.Atan2(xDif, yDif);

        angleToMove = angle;
        cos         = Mathf.Cos(angleToMove - Mathf.PI);
        sin         = Mathf.Sin(angleToMove - Mathf.PI);
        rotation.y  = -(Mathf.PI * 2 - angleToMove + Mathf.PI * .5f) * Mathf.Rad2Deg;
        transform.localEulerAngles = rotation;
        BShapes = GetComponent <SkinnedMeshRenderer>() as SkinnedMeshRenderer;
    }
 /// <summary>
 /// Assigns measurement and measurement type.
 /// </summary>
 /// <param name="measurement"></param>
 /// <param name="measurementType"></param>
 internal void AssignMeasurement(double? measurement, SleepType measurementType)
 {
     if (measurement.HasValue)
     {
         //A non null value is being assigned for this type
         _measurement = measurement;
         _measurementType = measurementType;
     }
     else if ((measurement.HasValue == false) && (_measurementType == measurementType))
     {
         //The measurements are being cleared.
         _measurement = null;
         _measurementType = null;
     }
 }
Exemplo n.º 20
0
        }                  //Needed for DB

        public Sleep(DateTime datetime, SleepType sleepType)
        {
            this.DateTime  = datetime;
            this.SleepType = sleepType;
        }