예제 #1
0
    public static IEnumerator Create(GhostData data, Emplacement place, string entityCls)
    {
        /** Create a Ghost with buffs, death-fragment (string cvar) and slowfall */
        // all ghost are lost at +100 and 3s
        if (data.drop > 0)
        {
            place.position.y = place.position.y + 40;
        }
        Entity[] Tracker   = new Entity[] { null };
        Entity   Requested = EntityCreation.Spawn(place.position, entityCls);

        yield return(EntityCreation.WaitEntity(Requested, 1.5f, Tracker));

        EntityAlive created = Tracker[0] as EntityAlive;

        if (created == null)
        {
            // Printer.Print("EntityGhost. Null:", Tracker[0]);
            yield break;
        }
        // Printer.Print("EntityGhost.Create:", created);
        if (data.deadFragment != "")
        {
            // created.SetCVar("ZBvalue_buffZBexplosif", StringMap.Encode(data.deadFragment));
            created.SetCVar(MinEventActionExplodeEntity.cvarKey, StringMap.Encode(data.deadFragment));
            //Printer.Print("EntityGhost.Create:", "ZBvalue_buffZBexplosif", StringMap.Encode(data.deadFragment));
        }
        foreach (string buff in data.buffs)
        {
            created.Buffs.AddBuff(buff);
            //Printer.Print("EntityGhost.Create:", buff, created);
        }
        if (data.drop > 0)
        {
            //Printer.Print("EntityGhost.SlowFall:", data.drop, created);
            EntityMover.SlowFall.Start(Tracker[0], data.drop, 0);
        }
    }
예제 #2
0
파일: Canvas.cs 프로젝트: SteveDunn/oglr
        public Canvas(IMainForm mainForm, IModel model)
        {
            _inputHandlerForWhenEditorIdle                 = new InputHandlerForWhenEditorIdle(this);
            _inputHandlerForWhenMovingOrCopyingItems       = new InputHandlerForWhenMovingOrCopyingItems(this);
            _inputHandlerWhenRotatingItems                 = new InputHandlerWhenRotatingItems(this);
            _inputHandlerWhenScalingItems                  = new InputHandlerWhenScalingItems(this);
            _inputHandlerWhenCreatingTheSelectionRectangle = new InputHandlerWhenCreatingTheSelectionRectangle(this);

            _mainForm = mainForm;

            _model = model;

            _model.NewModelLoaded += newModelLoaded;

            _entityCreation = new EntityCreation(whenEntityReadyToBeAdded: () =>
            {
                addTheEntityCurrentlyBeingCreated( );
                _entityCreation.ClearCurrentEditor( );
                _entityCreation.StartedCreating = false;
            });

            _inputActionLookup = new Dictionary <UserActionInEditor, Action>
            {
                {
                    UserActionInEditor.Idle, _inputHandlerForWhenEditorIdle.Update
                },
                {
                    UserActionInEditor.MovingItems, _inputHandlerForWhenMovingOrCopyingItems.Update
                },
                {
                    UserActionInEditor.CopyingItems, _inputHandlerForWhenMovingOrCopyingItems.Update
                },
                {
                    UserActionInEditor.RotatingItems, _inputHandlerWhenRotatingItems.Update
                },
                {
                    UserActionInEditor.ScalingItems, _inputHandlerWhenScalingItems.Update
                },
                {
                    UserActionInEditor.MovingTheCamera, handleUpdateWhenMovingTheCamera
                },
                {
                    UserActionInEditor.CreatingSelectionBoxByDragging, _inputHandlerWhenCreatingTheSelectionRectangle.Update
                },
                {
                    UserActionInEditor.AddingAnItem, handleInputWhenAddingAnEntity
                },
            };

            _userActionInEditor = UserActionInEditor.Idle;

            _positionsBeforeUserInteraction = new List <Vector2>( );

            _rotationsBeforeUserInteraction = new List <float>( );

            _scalesBeforeUserInteraction = new List <Vector2>( );

            Stream stream = safeGetManifestResourceStream(@"Oglr.Resources.cursors.dragcopy.cur");

            new Cursor(stream);

            stream        = safeGetManifestResourceStream(@"Oglr.Resources.cursors.rotate.cur");
            _cursorRotate = new Cursor(stream);

            stream       = safeGetManifestResourceStream(@"Oglr.Resources.cursors.scale.cur");
            _cursorScale = new Cursor(stream);

            Constants.TryToLoadOtherwiseSetDefaults(@"settings.xml");
        }
예제 #3
0
 public void WhenEnteringEditor(ICanvas canvas, DraggingContext context)
 {
     _entityCreation = canvas.StartCreatingEntityNow(_creationProperties);
 }