Пример #1
0
        public override void EndTouch(Entity other)
        {
            if (TouchedProp != other || !TouchedProp.IsValid)
            {
                return;
            }

            ((FoodEntity)TouchedProp).PhysicsBody.AngularDamping = 0f;
            ((FoodEntity)TouchedProp).PhysicsBody.LinearDamping  = 0f;

            TouchedProp = null;
            KnifeEntity?.SetAnimParam("isReady", false);
        }
Пример #2
0
        public override void StartTouch(Entity other)
        {
            if (TouchedProp.IsValid || other is not FoodEntity food || LastChop.Relative < 0.8f || !food.CanProcess(WorkType))
            {
                return;
            }

            TouchedProp = food;

            food.PhysicsBody.AngularDamping = 10f;
            food.PhysicsBody.LinearDamping  = 4f;

            KnifeEntity?.SetAnimParam("isReady", true);
        }
Пример #3
0
        public override bool Process()
        {
            KnifeEntity.SetAnimParam("Chop", true);

            LastChop = 0;
            var touchedProp = (FoodEntity)TouchedProp;

            if (touchedProp.DoProcess(WorkType))
            {
                touchedProp.Position += Vector3.Up * 7f;
            }

            var particles = Particles.Create("content/particles/chop.vpcf", touchedProp, "");

            if (_lastPlayer.IsValid)
            {
                DoShake(To.Single(_lastPlayer));
            }

            return(true);
        }