示例#1
0
        public override void Load(BodyHandle bodyHandle, ConnectionState connectionState, Simulator simulator, ObjectState state)
        {
            base.Load(bodyHandle, connectionState, simulator, state);
            PhyInterval worker = new PhyInterval(1, simulator);

            worker.Completed += Tick;


            material = new SimpleMaterial
            {
                FrictionCoefficient     = .97f,
                MaximumRecoveryVelocity = float.MaxValue,
                SpringSettings          = new SpringSettings(1f, 1.5f)
            };
            simulator.collidableMaterials.Allocate(bodyHandle) = material;

            reference = simulator.Simulation.Bodies.GetBodyReference(bodyHandle);
            simulator.OnContactListeners.Add(this.bodyHandle, this);


            SetPositionToStartPoint();
            CreateBall();
            CreateUser();
            CreateGauntlet();


            jumpState       = new JumpState(this);
            snappedState    = new SnappedState(this);
            notSnappedState = new Not_SnappedState(this);
            shotState       = new ShootState(this);
        }
 public void Activate(bool active)
 {
     if (!isInit())
     {
         var timer = new PhyInterval(1, Player.simulator);
         timer.Completed += OnTick;
         golfBallRef      = Player.golfball.GetReference();
         vehicle          = new Vehicle(Player.golfball);
         Player.simulator.Simulation.Awakener.AwakenBody(golfBallRef.Handle);
     }
     if (isInit())
     {
         //golfBallRef.
         QuixConsole.Log("Gauntlet", active);
         vehicle.isActive = active;
         Player.simulator.Simulation.Awakener.AwakenBody(golfBallRef.Handle);
     }
     if (!hasStopped)
     {
         // Player.golfball.Stop();
         hasStopped = true;
     }
     if (!active)
     {
         hasStopped = false;
     }
 }
示例#3
0
        public override void Load(BodyHandle bodyHandle, ConnectionState connectionState, Simulator simulator, ObjectState state)
        {
            base.Load(bodyHandle, connectionState, simulator, state);
            vehicle = new Vehicle(this);

            PhyInterval worker = new PhyInterval(1, simulator);

            worker.Completed += Tick;
            behaviour         = new CrocoBehaviour(this);
        }