Пример #1
0
        private static EventAction <GameEntityModel> .ExecutionDelegate BuildGrab(Storage.GenericParameter parameter)
        {
            int subjectId = parameter.SafeInt(1);
            int anchorId  = parameter.SafeInt(2);

            return(delegate(GameEntityModel model, List <GameEntityModel>[] subjectModels){
                List <GameEntityModel> refSubjects = ConditionUtils <GameEntityModel> .GetNonEmptySubjectOrNil(subjectModels, subjectId);

                if (refSubjects == null || refSubjects.Count == 0)
                {
                    return;
                }
                GameEntityModel refModel = refSubjects[StateManager.state.Random.NextInt(0, refSubjects.Count - 1)];
                GameEntityAnchoringOperations.AnchorEntity(model, refModel, anchorId);
            });
        }
Пример #2
0
        private static EventAction <GameEntityModel> .ExecutionDelegate BuildReleaseOwnership(Storage.GenericParameter parameter)
        {
            int subjectId = parameter.SafeInt(1);

            return(delegate(GameEntityModel model, List <GameEntityModel>[] subjectModels){
                List <GameEntityModel> subjectToBeReleased = ConditionUtils <GameEntityModel> .GetNonEmptySubjectOrNil(subjectModels, subjectId);

                if (subjectToBeReleased == null || subjectToBeReleased.Count == 0)
                {
                    return;
                }
                foreach (GameEntityModel entityToBeReleased in subjectToBeReleased)
                {
                    GameEntityAnchoringOperations.ReleaseOwnership(entityToBeReleased);
                }
            });
        }
Пример #3
0
        private static EventAction <GameEntityModel> .ExecutionDelegate BuildReleaseGrab(Storage.GenericParameter parameter)
        {
            int subjectId = parameter.SafeInt(1);

            return(delegate(GameEntityModel model, List <GameEntityModel>[] subjectModels){
                List <GameEntityModel> refSubjects = ConditionUtils <GameEntityModel> .GetNonEmptySubjectOrNil(subjectModels, subjectId);

                if (refSubjects == null || refSubjects.Count == 0)
                {
                    return;
                }
                foreach (GameEntityModel refSubject in refSubjects)
                {
                    GameEntityAnchoringOperations.ReleaseAnchoredEntity(model, refSubject);
                }
            });
        }