コード例 #1
0
ファイル: AbstractActor.cs プロジェクト: scscgit/Space-Impact
        public void AddedToField(IField field)
        {
            DeleteActor();
            Field = field;
            AddedToFieldHook();

            //Adds all parts too
            foreach (IActorCompositePart part in ActorComposition)
            {
                field.AddActor(part);
            }
        }
コード例 #2
0
        public void Initialize()
        {
            IsEnd = false;
            foreach (var entry in _eventEntries)
            {
                switch (entry)
                {
                case SetEndFrame item:
                    _eventDuration = item.EndFrame;
                    break;

                case ReadAssets assets:
                    foreach (var assetEntry in assets.Set)
                    {
                        switch (assetEntry)
                        {
                        case ReadActor item:
                            _actors[item.ActorId] = item.Name;
                            _field.AddActor(item.ActorId, item.ObjectId);
                            _field.SetActorVisibility(item.ActorId, false);
                            break;
                        }
                    }

                    // Double for-loop to ensure to load actors first, then
                    // animations to prevent crashes.
                    foreach (var assetEntry in assets.Set)
                    {
                        switch (assetEntry)
                        {
                        case ReadMotion item:
                            _field.SetActorAnimation(
                                item.ActorId,
                                GetAnmPath(item.ActorId, item.Name));
                            _field.SetActorVisibility(item.ActorId, item.UnknownIndex == 0);
                            break;
                        }
                    }
                    break;

                case EventStart item:
                    _field.FadeFromBlack(item.FadeIn * TimeMul);
                    break;

                case SetCameraData item:
                    _cameras.Add(item);
                    break;
                }
            }

            _cameraId = 0;
        }
コード例 #3
0
ファイル: AbstractLevel.cs プロジェクト: scscgit/Space-Impact
        public void AddToField(IField field)
        {
            //Saving the Field so that the Level construction can use its public a accessors
            Field    = field;
            Spawners = new List <ISpawner>();

            Construct();

            int spawnerCount = Spawners.Count;

            Log.i(this, "Adding " + spawnerCount.ToString() + " spawner" + (spawnerCount == 1 ? "" : "s") + " to the Field");
            foreach (ISpawner spawner in Spawners)
            {
                field.AddActor(spawner);
            }
        }