Ejemplo n.º 1
0
        private Scene LoadFlightTest()
        {
            var scene = new Scene(new Vector2f(Int16.MaxValue * 2, 768));

            scene.CreateCamera();

            var player = ObjectsManager.Build((uint)ObjectID.Player, new Vector2f(256, 300));

            scene.Add(player);

            for (var x = 0; x < scene.Size.X; x += 512)
            {
                var upperWall  = ObjectsManager.Build((uint)ObjectID.Wall, new Vector2f(x, 0));
                var bottomWall = ObjectsManager.Build((uint)ObjectID.Wall, new Vector2f(x, scene.Size.Y - 128));
                scene.Add(upperWall);
                scene.Add(bottomWall);
            }

            for (var x = 500; x < 2000; x += 256)
            {
                scene.Add(ObjectsManager.Build((uint)ObjectID.GreenShip, new Vector2f(x, 128 + 64)));
                scene.Add(ObjectsManager.Build((uint)ObjectID.GreenShip, new Vector2f(x, scene.Size.Y - 64 - 256)));
            }

            scene.Commit();
            return(PrepareScene(scene));
        }
Ejemplo n.º 2
0
        /// <summary>
        ///     Init bot functions.
        /// </summary>
        public static void Init()
        {
            try
            {
                // Initialize Genesis Spell Library.
                SpellManager.Initialize();
                SpellLibrary.Initialize();

                // Initialize ObjectsManager.
                ObjectsManager.Init();

                SpecialChamps.Init();

                // Overrides Orbwalker Movements
                Orbwalker.OverrideOrbwalkPosition += OverrideOrbwalkPosition;

                // Initialize AutoLvlup.
                LvlupSpells.Init();

                // Initialize TeamFights Detector.
                TeamFightsDetection.Init();

                Obj_AI_Base.OnBasicAttack        += Obj_AI_Base_OnBasicAttack;
                Gapcloser.OnGapcloser            += SpellsCasting.GapcloserOnOnGapcloser;
                Interrupter.OnInterruptableSpell += SpellsCasting.Interrupter_OnInterruptableSpell;
                Obj_AI_Base.OnBasicAttack        += SpellsCasting.Obj_AI_Base_OnBasicAttack;
                Obj_AI_Base.OnProcessSpellCast   += SpellsCasting.Obj_AI_Base_OnProcessSpellCast;
            }
            catch (Exception ex)
            {
                Logger.Send("There was an Error While Initialize Brain", ex, Logger.LogLevel.Error);
            }
        }
Ejemplo n.º 3
0
 public bool OnAfterDeserialize()
 {
     if (m_Data == null)
     {
         m_Data = new Dictionary <string, IPlayerData>();
     }
     m_CorruptedDataList.Clear();
     m_Data.Clear();
     foreach (SafeLoadCheck <IPlayerData> dataItem in m_DataList)
     {
         if (dataItem.Invalid)
         {
             m_CorruptedDataList.Add(dataItem);
             continue;
         }
         IPlayerData playerData = ObjectsManager.FindObjectByIdentifier <IPlayerData>(dataItem.Object.Identifier);
         if (playerData == null)
         {
             m_CorruptedDataList.Add(dataItem);
             continue;
         }
         m_Data.Add(dataItem.Object.Identifier, dataItem.Object);
     }
     return(true);
 }
Ejemplo n.º 4
0
 protected virtual void Awake()
 {
     originalScale = transform.localScale.x;
     rb = GetComponent<Rigidbody>();
     _manager = (ObjectsManager) SpawnManager.sm.GetComponent(getManager());
     rb.mass = _manager.mass;
 }
Ejemplo n.º 5
0
 private void Awake()
 {
     if (Instance != this)
     {
         Instance = this;
     }
 }
Ejemplo n.º 6
0
    // Use this for initialization
    void Start()
    {
        _ARController       = FindObjectOfType <HelloARController>();
        _listItemController = FindObjectOfType <ObjectsListController>();
        _objectsManager     = FindObjectOfType <ObjectsManager>();


        _listItemController.ListItemSelected += (id) =>
        {
            var dataModel = _objectsManager.GetBundleData(id);

            if (dataModel != null)
            {
                _ARController.CurrentDataModel = dataModel;
            }
            else
            {
                Debug.LogError("Can't find datamodel: " + id);
            }
        };

        _listItemController.ClearSceneButtonPressed += () =>
        {
            _ARController.DestroyAllAssets();
        };
    }
Ejemplo n.º 7
0
 private void Start()
 {
     objectsManager = GameObject.FindObjectOfType <ObjectsManager>();
     SpawnObjects(car, obstaclesSpawnPoints);
     SpawnObjects(floatingObj, floatingItemsSpawnPoints);
     SpawnObjects(floatingAnimal, floatingAnimalSpawnPoints);
     SpawnPlayer();
 }
Ejemplo n.º 8
0
        protected override void LoadContent()
        {
            _spriteBatch = new SpriteBatch(GraphicsDevice);

            Manager = new ObjectsManager();

            Manager.AddTexture("Player", Content.Load <Texture2D>("Player"));
            Manager.AddTexture("Bullet", Content.Load <Texture2D>("Bullet"));
        }
Ejemplo n.º 9
0
    public static void ActivateRoom(GameObject room, bool active)
    {
        if (!NetworkManagerCustom.IsServer)
        {
            room.SetActive(active);
            return;
        }

        if (active)
        {
            room.SetActive(true);
            if (room.GetComponent <Room>().Initialized)
            {
                Vector2Int pos = room.GetComponent <Room>().Position;

                Transform parent = room.transform.Find("Objects");
                foreach (SerializationManager.LoadedWorld.LoadedObject loadedObject in SerializationManager.World.Objects[pos.x, pos.y])
                {
                    GameObject gameObject = ObjectsManager.SpawnGameObject(Utils.FindAssetID(loadedObject.AssetID),
                                                                           Vector2.zero, Vector3.zero, parent, true);
                    SerializationManager.DeserializeObject(gameObject, loadedObject.Data);
                    NetworkServer.Spawn(gameObject);
                }
            }
            else
            {
                InitializeRoom(room);
            }

            SerializationManager.MarkDirtySave = true;
            List <string>         networkIds = new List <string>();
            List <List <string> > data       = new List <List <string> >();
            Transform             parent0    = room.transform.Find("Objects");
            for (int i = 0; i < parent0.childCount; i++)
            {
                if (parent0.GetChild(i).GetComponent <ISerializableObject>() != null)
                {
                    networkIds.Add(parent0.transform.GetChild(i).GetComponent <NetworkIdentity>().netId.ToString());
                    data.Add(SerializationManager.SerializeObject(parent0.GetChild(i).gameObject));
                }
            }
            MessageManager.SetActiveRoomClientMessage.SendToAllClients(new ActiveRoomMessage(room.GetComponent <Room>().Position, networkIds, data));
        }
        else
        {
            SerializationManager.SaveWorld();
            Transform parent = room.transform.Find("Objects");
            for (int i = 0; i < parent.childCount; i++)
            {
                if (parent.GetChild(i).gameObject.GetComponent <NetworkIdentity>() != null)
                {
                    NetworkServer.Destroy(parent.GetChild(i).gameObject);
                }
            }
            room.SetActive(false);
        }
    }
Ejemplo n.º 10
0
 private void Awake()
 {
     m_MovableObject = GetComponent <MoveableObject>();
     m_Rigidbody     = GetComponent <Rigidbody>();
     m_ObjectManager = FindObjectOfType <ObjectsManager>();
     if (m_ObjectManager)
     {
         m_ObjectManager.m_ChairList.Add(this);
     }
 }
Ejemplo n.º 11
0
    void Awake()
    {
        Academy.Instance.OnEnvironmentReset += ResetEnv;
        Academy.Instance.AgentPreStep       += PreStep;

        _manager      = GetComponent <ObjectsManager>();
        _config       = GetComponent <Config>();
        _wallsSpawner = GetComponent <WallsSpawner>();
        _seenHolder   = GetComponent <SeenHolder>();
    }
Ejemplo n.º 12
0
        public async Task TestObjectsLoading()
        {
            var pkg        = new GamePackage(GamePackageName);
            var objManager = new ObjectsManager(pkg);
            await objManager.LoadDefinitions();

            var fieldObject = objManager.CreateObject("field");

            Assert.IsTrue(fieldObject.Type == ObjectType.Static);
        }
Ejemplo n.º 13
0
    public static void DropItemStack(ItemStack stack, Vector3 position, Vector3 force)
    {
        GameObject stackObject = ObjectsManager.SpawnRoomObject(
            new RoomObject("entityItem", new Vector3(position.x % 495, position.y % 277, position.z), GameManager.rnd.Next(), false, false, 0,
                           new[] { stack.ItemName, stack.StackSize + "" }),
            Utils.GetRoomFromPosition(position).transform.Find("Objects"));

        stackObject.GetComponent <Rigidbody2D>().AddForce(force);
        NetworkServer.Spawn(stackObject);
    }
Ejemplo n.º 14
0
        public SceneEditor(EditorWindow window)
        {
            this.window        = window;
            window.ModeSwitch += ModeSwitched;

            CreateNewScene(800, 600);
            SpriteSet = new Dictionary <uint, Bitmap>();
            SpriteSet.Add(0, new Bitmap(1, 1));
            ObjectsManager.NewTextureBinded += LoadBitmap;
            ObjectsManager.LoadDefaultFolder();
        }
Ejemplo n.º 15
0
 private void Start()
 {
     m_ChairManager = FindObjectOfType <ObjectsManager>();
     m_EntryPoint   = FindObjectOfType <EntryPoint>();
     m_NavMeshAgent = GetComponent <NavMeshAgent>();
     m_Renderer     = GetComponentInChildren <Animator>().gameObject;
     m_MayhemMeter  = m_EntryPoint.m_MayhemMeter;
     m_ExitPosition = m_EntryPoint.LeavePoint.transform.position;
     m_Animator     = GetComponentInChildren <Animator>();
     m_Animator.CrossFade("Boy_Idle", 0.5f);
 }
Ejemplo n.º 16
0
Archivo: kCore.cs Proyecto: jitart/adc
        public static void Execute()
        {
            switch (Game.MapId)
            {
            case GameMapId.SummonersRift:
                Junglemobs = new[]
                {
                    "SRU_Dragon_Air", "SRU_Dragon_Earth", "SRU_Dragon_Fire", "SRU_Dragon_Water", "SRU_Dragon_Elder", "SRU_Baron", "SRU_Gromp", "SRU_Krug", "SRU_Razorbeak",
                    "Sru_Crab", "SRU_Murkwolf", "SRU_Blue", "SRU_Red", "SRU_RiftHerald"
                };
                break;

            case GameMapId.CrystalScar:
                Junglemobs = new[] { "AscXerath" };
                break;

            case GameMapId.TwistedTreeline:
                Junglemobs = new[] { "TT_NWraith", "TT_NWolf", "TT_NGolem", "TT_Spiderboss" };
                break;

            default:
                Junglemobs = new[] { "None" };
                break;
            }

            DashManager.Init();
            CoreMenu = MainMenu.AddMenu("KappaCore", "KappaCore");
            GapMenu  = CoreMenu.AddSubMenu("Anti-GapCloser Settings");
            ks       = CoreMenu.AddSubMenu("Stealer");

            GapMenu.AddGroupLabel("Anti GapCloser Champions");
            foreach (var enemy in EntityManager.Heroes.Enemies)
            {
                foreach (var spell in Gapcloser.GapCloserList.Where(e => enemy.ChampionName == e.ChampName))
                {
                    GapMenu.Add(spell.SpellName + enemy.ID(), new CheckBox(spell.ChampName + " " + spell.SpellSlot));
                }
            }

            ks.AddGroupLabel("KillSteal Champions");
            foreach (var hero in EntityManager.Heroes.Enemies)
            {
                ks.Add(hero.ID(), new CheckBox(hero.ChampionName + " (" + hero.Name + ")"));
            }

            ks.AddSeparator(1);
            ks.AddGroupLabel("JungleSteal Mobs");
            foreach (var mob in Junglemobs)
            {
                ks.Add(mob, new CheckBox(mob));
            }

            ObjectsManager.Init();
        }
Ejemplo n.º 17
0
 private void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
     else if (Instance != this)
     {
         Destroy(gameObject);
     }
 }
Ejemplo n.º 18
0
        private void SpawnLaser(IGameObject turret, Scene world, Vector2f laserSpeed)
        {
            var gunPosition  = turret.Body.Incircle.Radius * turret.Body.Rotation.Normalize();
            var shotPosition = turret.Body.Incircle.Center + gunPosition;
            var laser        = ObjectsManager.Build((uint)ObjectID.Laser, shotPosition);
            var laserScript  = new LaserScript(laserSpeed, ObjectID.Turret);

            laser.BindScript(laserScript);
            laser.Lighting.Add(new Light(new Vector2f(0.1f, 0.1f), Color.Magenta, LightMode.Flashlight));
            world.Add(laser);
        }
Ejemplo n.º 19
0
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else if (instance != this)
     {
         Destroy(gameObject);
     }
     DontDestroyOnLoad(gameObject);
 }
    // Start is called before the first frame update
    void Start()
    {
        _rBody    = GetComponentInChildren <Rigidbody>();
        _material = GetComponentInChildren <MeshRenderer>().material;

        var parent = transform.parent;

        _manager     = parent.GetComponent <ObjectsManager>();
        _config      = parent.GetComponent <Config>();
        _spawnHelper = parent.GetComponent <SpawnHelper>();
        //Respawn();
    }
Ejemplo n.º 21
0
  void Awake() {
    objectsManager = (ObjectsManager) GameObject.Find("Field Objects").GetComponent(getManager());

    if (isNegativeObject()) {
      transSkill = (Skill_Transform)SkillManager.sm.getSkill("Polymorph");
    }

    shrinkedScale = transform.localScale.x;
    rb = GetComponent<Rigidbody>();
    originalScale = transform.localScale.x;
    player = Player.pl;
    initializeRest();
  }
Ejemplo n.º 22
0
 private void Awake()
 {
     // Déclaration du singleton
     if (instance != null && instance != this)
     {
         Destroy(this.gameObject);
         return;
     }
     else
     {
         instance = this;
     }
 }
Ejemplo n.º 23
0
    private void Start()
    {
        GetComponent <DeathStandart>().GetEventSystem <DeathStandart.DeathEvent>().SubcribeEvent(e => {
            int count = GameManager.rnd.Next(3) + 3;

            for (int i = 0; i < count; i++)
            {
                GameObject banana = ObjectsManager.SpawnGameObject(Banana, transform.position + new Vector3(0, 0, -0.001f), new Vector3(), null, true);
                banana.GetComponent <Rigidbody2D>().AddForce(Utils.RandomPoint(3000) + new Vector2(1500, 3000));
                banana.GetComponent <SpawnedData>().spawnedData = GetComponent <SpawnedData>().spawnedData;
            }
        });
    }
Ejemplo n.º 24
0
        public async Task TestSceneLoading()
        {
            var pkg = new GamePackage(GamePackageName);

            var objManager = new ObjectsManager(pkg);
            await objManager.LoadDefinitions();

            var roomLoader = new GameRoomLoader(pkg);
            var room       = await roomLoader.Load(objManager);

            Assert.AreNotEqual(0, room.Interior.Count);
            Assert.AreNotEqual(0, room.PresentationMetadata.PointsOfView.Count);
        }
Ejemplo n.º 25
0
    void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        else if (instance != this)
        {
            Destroy(gameObject);
        }

        DontDestroyOnLoad(gameObject);
        dolls = new ArrayList();
    }
Ejemplo n.º 26
0
Archivo: Brain.cs Proyecto: uvbs/WSUBot
        /// <summary>
        ///     Init bot functions.
        /// </summary>
        public static void Init()
        {
            try
            {
                // Initialize Genesis Spell Library.
                SpellManager.Initialize();
                SpellLibrary.Initialize();

                // Initialize The ModesManager
                ModesManager.Init();

                // Initialize ObjectsManager.
                ObjectsManager.Init();

                // Initialize Special Champions Logic.
                SpecialChamps.Init();

                // Initialize Cache.
                Cache.Init();

                // Overrides Orbwalker Movements
                Orbwalker.OverrideOrbwalkPosition += OverrideOrbwalkPosition;

                // Initialize AutoLvlup.
                LvlupSpells.Init();

                // Initialize TeamFights Detector.
                Detector.Init();

                Spellbook.OnCastSpell += delegate(Spellbook sender, SpellbookCastSpellEventArgs args)
                {
                    if (sender.Owner.IsMe && RunningItDownMid)
                    {
                        args.Process = false;
                        Logger.Send("Blocked: " + args.Slot + " Reason: Running It Down Mid");
                    }
                };

                Obj_AI_Base.OnBasicAttack        += Obj_AI_Base_OnBasicAttack;
                Gapcloser.OnGapcloser            += SpellsCasting.GapcloserOnOnGapcloser;
                Interrupter.OnInterruptableSpell += SpellsCasting.Interrupter_OnInterruptableSpell;
                //Obj_AI_Base.OnBasicAttack += SpellsCasting.Obj_AI_Base_OnBasicAttack;
                //Obj_AI_Base.OnProcessSpellCast += SpellsCasting.Obj_AI_Base_OnProcessSpellCast;
            }
            catch (Exception ex)
            {
                Logger.Send("There was an Error While Initialize Brain", ex, Logger.LogLevel.Error);
            }
        }
Ejemplo n.º 27
0
        public void Delete()
        {
            ContextData cd = Get("core.datas.context") as ContextData;

            if (cd == null)
            {
                return;
            }
            GameMode gameMode = ObjectsManager.FindObjectByIdentifier <GameMode>(cd.GameMode);

            if (gameMode == null)
            {
                return;
            }
            PlayerManager.Delete(gameMode.FolderName + "/" + cd.SaveFileName);
        }
Ejemplo n.º 28
0
    public void Awake()
    {
        singleton = this;
        GameSettings.Load();
        Timer.InitializeCreate();
        LanguageManager.Initialize();
        LanguageManager.SetLanguage(x => x.Code.Equals(GameSettings.SettingLanguageCode.Value));
        ItemManager.Initialize();
        //MessageManager.Initialize();

        ObjectsManager.LoadAllObjectsFromResources();
        RoomLoader.LoadAllRoomsFromResources();
        RoomLayerMask   = LayerMask.GetMask("Room");
        PlayerLayerMask = LayerMask.GetMask("Player");
        TrapLayerMask   = LayerMask.GetMask("Trap");
    }
Ejemplo n.º 29
0
        public void SaveEditingObject(string filename, string textureName)
        {
            var id             = EditingObject.ID;
            var size           = EditingObject.Body.Size;
            var weight         = EditingObject.Body.Weight;
            var colliderOffset = EditingObject.Body.Collider.Position - EditingObject.Body.Position;
            var isSolid        = EditingObject.Body.IsSolid;
            var isStatic       = EditingObject.Body.IsStatic;

            ObjectsManager.Register(id, size, weight, colliderOffset, isSolid, isStatic, textureName, filename);
            ObjectsManager.SaveToFile(filename, textureName, EditingObject);

            if (ObjectSaved != null)
            {
                ObjectSaved(this, EventArgs.Empty);
            }
        }
Ejemplo n.º 30
0
        private void SpawnLaser(IGameObject ship, Scene world)
        {
            var gunsPosition = ship.Body.Rotation;
            var sideOffset   = gunsPosition.Orthogonal() * (leftGunIsShooting ? 1 : -1) * selfSpriteSize / 4;
            var laserOffset  = new Vector2f(laserSpriteSize, laserSpriteSize) / 2;

            gunsPosition *= selfSpriteSize / 4;

            var shotPosition = ship.Body.Incircle.Center + gunsPosition + sideOffset - laserOffset;
            var laser        = ObjectsManager.Build((uint)ObjectID.Laser, shotPosition);
            var laserScript  = new LaserScript(ship.Body.Rotation * laserSpeed, ObjectID.Player);

            laser.BindScript(laserScript);
            laser.Lighting.Add(new Light(new Vector2f(0.1f, 0.1f), Color.Magenta, LightMode.Flashlight));
            leftGunIsShooting = !leftGunIsShooting;
            world.Add(laser);
        }
        public override void GeneratePossibleEnemies(ProceduralLevel level)
        {
            float maxEnemyDifficulty = m_MaximumEnemyDifficulty.Evaluate(level.Difficulty);

            Enemy[]      enemies         = ObjectsManager.GetAllObjects <Enemy>();
            List <Enemy> possibleEnemies = new List <Enemy>();

            foreach (Enemy enemy in enemies)
            {
                if (!enemy.IsSpawnable)
                {
                    continue;
                }
                if (enemy.Difficulty > maxEnemyDifficulty)
                {
                    continue;
                }
                possibleEnemies.Add(enemy);
            }
            if (possibleEnemies.Count == 0)
            {
                return;
            }

            possibleEnemies.Sort((a, b) => { return(a.Difficulty < b.Difficulty ? 1 : -1); });

            List <Enemy> selectedEnemies       = new List <Enemy>();
            float        chanceForSelection    = 0.8f;
            float        reductionPerSelection = 0.75f;

            foreach (Enemy enemy in possibleEnemies)
            {
                if (Random.Range(0.0f, 1.0f) <= chanceForSelection)
                {
                    selectedEnemies.Add(enemy);
                    chanceForSelection *= reductionPerSelection;
                }
            }

            if (selectedEnemies.Count == 0)
            {
                selectedEnemies.Add(possibleEnemies[0]);
            }

            level.PossibleEnemies = selectedEnemies.ToArray();
        }
Ejemplo n.º 32
0
 // Use this for initialization
 void Start()
 {
     if (mode != null && objectsManager != null)
     {
         objectsManager.AddOjbToList(this.gameObject);
     }
     if (objectsManager != null)
     {
         this.gameObject.GetComponent <Attractor>().objectsManager = objectsManager;
     }
     //Debug.LogError(this.gameObject.GetComponent<Attractor>());
     audioManager = (AudioManager)FindObjectOfType(typeof(AudioManager));
     if (mode != null && mode.DarkMatterModeBool == true)
     {
         this.gameObject.transform.GetChild(0).gameObject.SetActive(false);
         this.gameObject.transform.GetChild(1).gameObject.SetActive(true);
     }
 }
 public void CreateObjectManager()
 {
     Debug.Log ("object manager " + PlayerPrefs.GetInt("TrainingModeId"));
     if(manager != null) {
         manager.CancelSession();
         StopTimer();
         labelLeft.text = "";
         labelRight.text = "";
         StopAllCoroutines();
     }
     if (tutorialMode) {
         StopAllCoroutines();
     }
     DisplayText (" ");
     patient.SetActive(true);
     GameObject[] objects = GameObject.FindGameObjectsWithTag("BasicObject");
     foreach (GameObject o in objects) {
         Destroy(o);
     }
     if(PlayerPrefs.HasKey("TrainingModeId")) {
         switch(PlayerPrefs.GetInt("TrainingModeId")) {
         case 1: StartCoroutine(Tutorial()); break;
         case 2: manager = gameObject.AddComponent<RandomGenerator> (); break;
         case 3: manager = gameObject.AddComponent<ProgressiveDistanceGenerator> (); break;
         case 4: manager = gameObject.AddComponent<CustomGenerator> (); break;
         }
         if(manager != null && PlayerPrefs.GetInt("TrainingModeId")!=1) {
             StartCoroutine(StartCountdown());
         }
     }
 }