Пример #1
0
            public void Movement()
            {
                if (!EnableMovement || CurrentPath.Count == 0)
                {
                    StopMovement();
                    return;
                }
                Vector2 position = MainMotor.GetWorldPosition();

                if ((position - CurrentPath[CurrentPath.Count - 1]).Length() <= 1 || RailJoint == null)
                {
                    CurrentPath.RemoveAt(CurrentPath.Count - 1);
                    if (CurrentPath.Count == 0)
                    {
                        StopMovement();
                        return;
                    }
                    else
                    {
                        StopMovement(false);
                    }
                    RailJoint      = (IObjectRailJoint)GlobalGame.CreateObject("RailJoint", position);
                    TargetObject   = (IObjectTargetObjectJoint)GlobalGame.CreateObject("TargetObjectJoint", CurrentPath[CurrentPath.Count - 1]);
                    RailAttachment = (IObjectRailAttachmentJoint)GlobalGame.CreateObject("RailAttachmentJoint", position);
                    RailJoint.SetTargetObjectJoint(TargetObject);
                    RailAttachment.SetRailJoint(RailJoint);
                    RailAttachment.SetTargetObject(Hull);
                    RailAttachment.SetMotorEnabled(true);
                    RailAttachment.SetMaxMotorTorque(10);
                    RailAttachment.SetMotorSpeed(Speed);
                    Hull.SetBodyType(BodyType.Dynamic);
                }
            }
Пример #2
0
        public void Tattattaaa(TriggerArgs args)
        {
            Vector2 gunPosition = ((IObject)Game.GetSingleObjectByCustomId("fromHere")).GetWorldPosition() + new Vector2(0f, -5f);
            Vector2 Tohere      = ((IObject)Game.GetSingleObjectByCustomId("toHere")).GetWorldPosition() - gunPosition;

            if (gunPosition != null && Tohere != null)
            {
                Game.SpawnProjectile(ProjectileItem.SNIPER, gunPosition, Tohere);
            }
            if (!didIt)
            {
                IObjectRailAttachmentJoint rail = (IObjectRailAttachmentJoint)Game.GetSingleObjectByCustomId("Dog");
                rail.SetMotorEnabled(true);
                IObjectRailAttachmentJoint rails = (IObjectRailAttachmentJoint)Game.GetSingleObjectByCustomId("Dogs");
                rails.SetMotorEnabled(true);
                didIt = true;
            }
        }