Inheritance: AmSceneBase
Esempio n. 1
0
    public static GameScene getGameScene()
    {
        if(singleton==null)
                singleton=new GameScene();

            return singleton;
    }
Esempio n. 2
0
        public ProcedureSignature (string serviceName, string procedureName, string documentation, IProcedureHandler handler, GameScene gameScene, params string[] attributes)
        {
            Name = procedureName;
            FullyQualifiedName = serviceName + "." + Name;
            Documentation = DocumentationUtils.ResolveCrefs (documentation);
            Handler = handler;
            GameScene = gameScene;
            Attributes = attributes.ToList ();
            Parameters = handler.Parameters.Select (x => new ParameterSignature (FullyQualifiedName, x)).ToList ();

            // Add parameter type attributes
            for (int position = 0; position < Parameters.Count; position++)
                Attributes.AddRange (TypeUtils.ParameterTypeAttributes (position, Parameters [position].Type));

            var returnType = handler.ReturnType;
            HasReturnType = (returnType != typeof(void));
            if (HasReturnType) {
                ReturnType = returnType;
                // Check it's a valid return type
                if (!TypeUtils.IsAValidType (returnType))
                    throw new ServiceException (returnType + " is not a valid Procedure return type, " + "in " + FullyQualifiedName);
                // Add return type attributes
                Attributes.AddRange (TypeUtils.ReturnTypeAttributes (returnType));
            }
        }
Esempio n. 3
0
 /// <summary>
 /// 初始化
 /// </summary>
 protected virtual void Init()
 {
     if (Global.Instance.scene == SceneType.GameScene)
     {
         gs = GameObject.FindGameObjectWithTag(Tags.SceneController).GetComponent<GameScene>();
     }
 }
        public WolfEntity(Rectangle rect, Properties properties, GameScene gs)
        {
            position.X = rect.X;
            position.Y = rect.Y;

            spriteChoice.texture = spritesheet;
            animState.AnimationName = "alive";
            hitbox = new Rectangle (0, 0, rect.Width, rect.Height);
            spriteChoice.rect = anim.GetRectangle (animState);
            Visible = true;
            inverseMass = 5;

            health = 10;
            contactDamage = 2;
            fireDefense = 0;
            waterDefense = 0;
            earthDefense = 1;
            airDefense = 0;

            this.properties = properties;
            this.gs = gs;

            baseline = hitbox.Bottom;
            seePlayer = false;
            positionPushTimer = new TimeSpan(0,0,0,0,1000);

            backtracking = false;
        }
Esempio n. 5
0
 // CONSTRUCTOR --------------------------------------------------------------------------------------------------------
 public PausePanel(GameScene scene)
 {
     _scene = scene;
     if (_initialized == false) {
         Initialize();
     }
 }
        public GateEntity(Rectangle rect, Properties properties, GameScene gs)
        {
            position.X = rect.X;
            position.Y = rect.Y;
            spriteChoice.texture = gateTex;
            animState.AnimationName = "closed";
            Collidable = true;
            Visible = true;

            if (properties.ContainsKey ("any")) {
                foreach (String identifier in ((String)properties["any"]).Split(',')) {
                    any.Add (identifier);
                }

            }

            if (properties.ContainsKey ("require")) {
                foreach (String identifier in ((String)properties["require"]).Split(',')) {
                    require.Add (identifier);
                }

            }
            if (properties.ContainsKey ("forbid")) {
                foreach (String identifier in ((String)properties["forbid"]).Split(',')) {
                    forbid.Add (identifier);
                }
            }

            hitbox = new Rectangle(0,0,100,100);
            Visible = true;
            this.gs = gs;
        }
Esempio n. 7
0
	public Iobject(Iobject copy)
	{
		this.obj = copy.obj;
		this.parent = copy.parent;
		this.Immidate=copy.Immidate;
		this.InitScene = copy.InitScene;
		this.hasCreate = copy.hasCreate;
	}
Esempio n. 8
0
	public Iobject()
	{
		this.obj = null;
		this.parent = null;
		this.Immidate = false;
		this.InitScene = GameScene.LogoScene;
		this.hasCreate = false;
	}
 public GameScene(GameScene s, uint generatorId = 0)
 {
     ShadowObjects = s.ShadowObjects;
     VisibleObjects = s.VisibleObjects;
     objects = s.objects;
     sceneGraph = s.sceneGraph;
     idgenertor = new IdGenerator(generatorId);
 }
Esempio n. 10
0
 /// <summary>
 /// Create a service with the given name.
 /// </summary>
 public ServiceSignature (string name)
 {
     Name = name;
     Documentation = String.Empty;
     Classes = new Dictionary<string, ClassSignature> ();
     Enumerations = new Dictionary<string, EnumerationSignature> ();
     Procedures = new Dictionary<string, ProcedureSignature> ();
     GameScene = GameScene.All;
 }
        public GameState(Game1 gameSystem)
        {
            //Add in spawning code. Not yet used.
            Content = gameSystem.Content;
            EntitySpawners.Add("flytrap",delegate(Rectangle position) {return new FlytrapEntity(position);});
            EntitySpawners.Add ("wolf", delegate(Rectangle position) {return null;});
            EntitySpawners.Add ("fireElemental", delegate(Rectangle position) {return null;});
            EntitySpawners.Add("torch",delegate(Rectangle position) {return new TorchEntity(position);});
            EntitySpawners.Add("Terrain",delegate(Rectangle position) {return new TerrainEntity(position);});
            EntitySpawners.Add("boulder",delegate(Rectangle position) {return new BoulderEntity(position);});
            EntitySpawners.Add("pit",delegate(Rectangle position) {return new PitEntity(position);});
            EntitySpawners.Add("water",delegate(Rectangle position) {return new WaterEntity(position);});
            EntitySpawners.Add ("scroll", delegate(Rectangle position) {return null;});
            EntitySpawners.Add ("nothing", delegate(Rectangle position) {return null;});

            scene = new GameScene (this);
            this.gamesystem = gameSystem;

            //Add in level names from a file
            String line;

            //Note that this file name is hard coded!
            System.IO.StreamReader file =
                new System.IO.StreamReader(Path.Combine(Content.RootDirectory,"level_list.txt"));
            while((line = file.ReadLine()) != null)
            {
                line = line.Trim ();
                if (line.StartsWith ("#") || line.Equals("")) {
                    //Skip comments and blank lines.
                    continue;
                }

                //Cheesy arrow separator probably won't be in names.
                //There is no current way to escape it; so avoid putting "==>" in names!
                String[] separator = { "==>" };
                String[] fields = line.Split(separator,StringSplitOptions.RemoveEmptyEntries);

                if (fields.Length != 2) {
                    Console.Out.WriteLine ("Couldn't parse level list: \"" + line + "\"");
                } else {
                    //HACK: These two names are special, and must point to a previously set name.
                    if (fields [0].Equals ("TUTORIAL") || fields [0].Equals ("START")) {
                        if (LevelNames.ContainsKey (fields [1])) {
                            LevelNames.Add (fields [0], LevelNames [fields [1]]);
                        } else {
                            Console.Error.WriteLine ("Could not set " + fields [0] + ", " + fields [1] + " was not set.");
                        }
                    } else {
                        LevelNames.Add (fields [0], fields [1]);
                    }
                }
            }

            file.Close();

            //TODO: Verify "TUTORIAL" and "START" are set, fail appropriately if they are not.
        }
Esempio n. 12
0
 // CONSTRUCTOR -------------------------------------------------------------------------------------------
 public GameSceneHud( GameScene scene )
 {
     _scene = scene;
     if (_initialized == false) {
         Initialize();
     }
     #if DEBUG
     Console.WriteLine(GetType().ToString() + " created" );
     #endif
 }
Esempio n. 13
0
 /// <summary>
 /// Create a service signature from a C# type annotated with the KRPCService attribute
 /// </summary>
 /// <param name="type">Type.</param>
 public ServiceSignature (Type type)
 {
     TypeUtils.ValidateKRPCService (type);
     Name = TypeUtils.GetServiceName (type);
     Documentation = DocumentationUtils.ResolveCrefs (type.GetDocumentation ());
     Classes = new Dictionary<string, ClassSignature> ();
     Enumerations = new Dictionary<string, EnumerationSignature> ();
     Procedures = new Dictionary<string, ProcedureSignature> ();
     GameScene = TypeUtils.GetServiceGameScene (type);
 }
Esempio n. 14
0
	public Iobject(Transform parentTrans,GameObject pobj ,GameScene pscene,bool isImmidate =false)
	{
		this.obj = pobj;
		this.parent =  parentTrans;
		this.Immidate= isImmidate;
		this.InitScene = pscene;
		this.hasCreate = false;
		if(isImmidate && parent != null)
			obj.transform.parent = this.parent;
		
	}
Esempio n. 15
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Client.Common.Views.Effects.EffectLayer"/> class.
 /// </summary>
 /// <param name="gameScene">Game scene.</param>
 public EffectLayer(GameScene gameScene)
     : base()
 {
     m_gameScene = gameScene;
     Position = m_gameScene.WorldLayerHex.Position;
     Schedule(Testupdate);
     // AddHealthbar();
     // m_healthbar = new Healthbar();
     // m_healthbar.AnchorPoint = CCPoint.AnchorMiddle;
     // AddChild(m_healthbar);
 }
Esempio n. 16
0
 public void GameEnd(bool win)
 {
     if (win)
     {
         currentScene = GameScene.Win;
         Application.LoadLevel("WinScene");
     }
     else
     {
         currentScene = GameScene.GameOver;
         Application.LoadLevel("GameOver");
     }
 }
        public ScrollEntity(Rectangle rect, Properties properties, GameScene gameScene)
        {
            position.X = rect.X;
            position.Y = rect.Y;

            spriteChoice.texture = texture;
            spriteChoice.rect = texture.Bounds;
            hitbox = texture.Bounds;

            this.properties = properties;
            this.gameScene = gameScene;

            Visible = true;
        }
Esempio n. 18
0
        public InvaderGrid(GameScene scene, Vector2 position,Vector2 screenSize,int fireSpeed)
        {
            m_Scene = scene;
              m_Position = position;
              m_InitialPosition = position;
              m_ScreenSize = screenSize;
              m_Count = 64;
              m_InvaderRows = new List<InvaderBase>();
              m_ExplosionSample = new Explosion(new Vector2());
              float height = m_Position.Y;
              for (int rowNumber = 0; rowNumber < 5; rowNumber++)
              {
            if (rowNumber == 0) //Invader 1 row
            {
              for (int i = 0; i < 16; i++)
              {
            Invader1 invader = new Invader1(new Vector2(m_Position.X + i * (Invader1.InvaderWidth + 2), height),fireSpeed);
            invader.Dead +=new InvaderDeadEventHandler(invader_Dead);
            m_InvaderRows.Add(invader);
              }
              height += Invader1.InvaderHeight + 8;
            }

            if (rowNumber == 1 || rowNumber == 2)
            {
              for (int i = 0; i < 12; i++)
              {
            Invader2 invader = new Invader2(new Vector2(m_Position.X + i * (Invader2.InvaderWidth + 2), height),fireSpeed);
            invader.Dead += new InvaderDeadEventHandler(invader_Dead);
            m_InvaderRows.Add(invader);
              }
              height += Invader2.InvaderHeight + 8;
            }

            if (rowNumber == 3 || rowNumber == 4)
            {
              for (int i = 0; i < 12; i++)
              {
            Invader3 invader = new Invader3(new Vector2(m_Position.X + i * (Invader3.InvaderWidth + 2), height),fireSpeed);
            invader.Dead +=new InvaderDeadEventHandler(invader_Dead);
            m_InvaderRows.Add(invader);
              }
              height += Invader3.InvaderHeight + 8;
            }

              }
        }
Esempio n. 19
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Client.Common.Views.HUD.HUDLayer"/> class.
        /// </summary>
        /// <param name="gameScene">Game scene.</param>
        public HUDLayer(GameScene gameScene)
            : base()
        {
            m_gameScene = gameScene;

            m_gps = new Button(
                "radars2-standard",
                "radars2-touched",
                new Action(BackToGPS));
            m_gps.AnchorPoint = CCPoint.AnchorLowerLeft;
            AddChild(m_gps);

            m_debug = new Button(
                "debug-standard",
                "debug-touched",
                new Action(StartDebug));
            m_debug.AnchorPoint = CCPoint.AnchorLowerLeft;
            AddChild(m_debug);

            m_energyRessource = new EnergyResource();
            m_energyRessource.AnchorPoint = CCPoint.AnchorUpperLeft;
            AddChild(m_energyRessource);

            m_scrapResource = new ScrapResource(Constants.ClientConstants.SCRAP, CCColor3B.Orange);
            m_scrapResource.AnchorPoint = CCPoint.AnchorUpperLeft;
            AddChild(m_scrapResource);

            m_plutoniumResource = new PlutoniumResource(Constants.ClientConstants.PLUTONIUM, CCColor3B.Green);
            m_plutoniumResource.AnchorPoint = CCPoint.AnchorUpperLeft;
            AddChild(m_plutoniumResource);

            m_populationResource = new PopulationResource(Constants.ClientConstants.POPULATION, CCColor3B.White);
            m_populationResource.AnchorPoint = CCPoint.AnchorUpperLeft;
            AddChild(m_populationResource);

            m_techologyResource = new TechnologyResource(Constants.ClientConstants.TECHNOLOGY, CCColor3B.Blue);
            m_techologyResource.AnchorPoint = CCPoint.AnchorUpperLeft;
            AddChild(m_techologyResource);

            m_question = new Button(
                "question-standard",
                "question-touched",
                new Action(DeveloperFunction));
            m_question.AnchorPoint = CCPoint.AnchorLowerLeft;
            AddChild(m_question);
            m_question.Visible = false;
        }
        public override GameScene MakeScene()
        {
            //System.Windows.Forms.MessageBox.Show(Name);
            GameScene Menu = new GameScene(Name, Content.Load<Texture2D>(@"Images\Menu"), sprBatch);

            ButtonObject New_game = new ButtonObject(Content.Load<Texture2D>(@"Images\New_game"));
            New_game.Position = new Vector2(676, 200);
            New_game.Pressed += new EventHandler(New_game_Pressed);

            ButtonObject Exit = new ButtonObject(Content.Load<Texture2D>(@"Images\Exit"));
            Exit.Position = new Vector2(356, 3);
            Exit.Pressed += new EventHandler(Exit_Pressed);

            Menu.AddObject(Exit);
            Menu.AddObject(New_game);

            return Menu;
        }
Esempio n. 21
0
        /// <param name="gameScene">ゲーム場面</param>
        /// <param name="gameTime">ゲーム内部の時間</param>
        public GameInfo(GameScene gameScene, GameTime gameTime)
        {
            this.IsRunning = gameScene.IsRunning;
            this.HasFinished = gameScene.HasFinished;
            this.LimitTime = gameScene.LimitTime;
            this.CurrentTime = gameScene.CurrentTime;
            this.GameTime = gameTime;

            ManagerSet managerSet = gameScene.ManagerSet;
            AttackManager attackManager = managerSet.AttackManager;
            AttackInfos = attackManager.Info;

            Field field = managerSet.Field;
            FieldInfo = field.Info;

            PlayerManager playerManager = managerSet.PlayerManager;
            PlayerInfos = playerManager.Info;
        }
Esempio n. 22
0
        public ProcedureSignature(string serviceName, string procedureName, string documentation, IProcedureHandler handler, GameScene gameScene, params string[] attributes)
        {
            Name = procedureName;
            FullyQualifiedName = serviceName + "." + Name;
            Documentation = DocumentationUtils.ResolveCrefs (documentation);
            Handler = handler;
            GameScene = gameScene;
            Attributes = attributes.ToList ();
            Parameters = handler.Parameters.Select (x => new ParameterSignature (FullyQualifiedName, x)).ToList ();

            // Add parameter type attributes
            for (int position = 0; position < Parameters.Count; position++)
                Attributes.AddRange (TypeUtils.ParameterTypeAttributes (position, Parameters [position].Type));

            // Create builders for the parameter types that are message types
            ParameterBuilders = Parameters
                .Select (x => {
                try {
                    return ProtocolBuffers.IsAMessageType (x.Type) ? ProtocolBuffers.BuilderForMessageType (x.Type) : null;
                } catch (ArgumentException) {
                    throw new ServiceException ("Failed to instantiate a message builder for parameter type " + x.Type.Name);
                }
            }).ToArray ();
            HasReturnType = (handler.ReturnType != typeof(void));
            if (HasReturnType) {
                ReturnType = handler.ReturnType;
                // Check it's a valid return type
                if (!TypeUtils.IsAValidType (ReturnType)) {
                    throw new ServiceException (
                        ReturnType + " is not a valid Procedure return type, " +
                        "in " + FullyQualifiedName);
                }
                // Add return type attributes
                Attributes.AddRange (TypeUtils.ReturnTypeAttributes (ReturnType));
                // Create a builder if it's a message type
                if (ProtocolBuffers.IsAMessageType (ReturnType)) {
                    try {
                        ReturnBuilder = ProtocolBuffers.BuilderForMessageType (ReturnType);
                    } catch (ArgumentException) {
                        throw new ServiceException ("Failed to instantiate a message builder for return type " + ReturnType.Name);
                    }
                }
            }
        }
Esempio n. 23
0
 public void OnClick(string buttonName)
 {
     switch (buttonName)
     {
         case "Start":
             currentScene = GameScene.Game;
             loading = true;
             Application.LoadLevel("Level1");
             break;
         case "Restart":
             currentScene = GameScene.Game;
             loading = true;
             Application.LoadLevel("Level1");
             break;
         case "Quit":
             Application.Quit();
             break;
         default:
             break;
     }
 }
    private void Awake()
    {
        if (Global.Instance.scene == SceneType.GameScene)
        {
            this.CardName = GameObject.Find("CardInfo/Name/Label").GetComponent<UILabel>();
            this.CardType = GameObject.Find("CardInfo/Type/Label").GetComponent<UILabel>();
            this.CardRarity = GameObject.Find("CardInfo/Rarity/Label").GetComponent<UILabel>();
            this.CardOwner = GameObject.Find("CardInfo/Owner/Label").GetComponent<UILabel>();
            this.CardDes = GameObject.Find("CardInfo/Description/Label").GetComponent<UILabel>();
            this.CardSkillList = GameObject.Find("SkillList/Grid").GetComponent<UIGrid>();
            this.CardDesPanel = GameObject.Find("GamePanel/CardDes").GetComponent<UIPanel>();

            this.CardName.text = "";
            this.CardType.text = "";
            this.CardRarity.text = "";
            this.CardOwner.text = "";
            this.CardDes.text = "";

            this.gameSceneManager = GameObject.FindGameObjectWithTag(Tags.SceneController).GetComponent<GameScene>();
            ClearSkillButton();
        }
    }
Esempio n. 25
0
    public override void execute()
    {
        Room      room      = mReceiver as Room;
        GameScene gameScene = mGameSceneManager.getCurScene();

        if (gameScene.getSceneType() != GAME_SCENE_TYPE.GST_MAHJONG)
        {
            return;
        }
        // 重新计算客户端位置
        CharacterData data       = mCharacter.getCharacterData();
        CharacterData myselfData = mCharacterManager.getMyself().getCharacterData();

        data.mPosition = GameUtility.serverPositionToClientPosition(data.mServerPosition, myselfData.mServerPosition);
        // 通知房间有玩家加入本局麻将
        room.notifyPlayerJoin(mCharacter);
        // 只能在麻将场景的等待流程才能通知加入
        if (gameScene.atProcedure(PROCEDURE_TYPE.PT_MAHJONG_WAITING))
        {
            ScriptAllCharacterInfo allInfo = mLayoutManager.getScript(LAYOUT_TYPE.LT_ALL_CHARACTER_INFO) as ScriptAllCharacterInfo;
            allInfo.notifyCharacterJoin(mCharacter);
        }
    }
        private void Start()
        {
            PivotScene = GameScene.HomeMenu;

            var isAnySceneLoaded = false;

            foreach (GameScene scene in Enum.GetValues(typeof(GameScene)))
            {
                if (!scene.IsLoaded())
                {
                    continue;
                }
                isAnySceneLoaded = true;
                SceneManager.SetActiveScene(scene.GetScene());
            }

            if (!isAnySceneLoaded)
            {
                StartCoroutine(LoadSceneAsync(GameScene.HomeMenu));
            }

            DataManager.OnGameDataUpdated += GameDataUpdated;
        }
Esempio n. 27
0
        protected override void OnThrow(int cell)
        {
            var enemy = Actor.FindChar(cell);

            if (enemy == null || enemy == CurUser)
            {
                if (Level.flamable[cell])
                {
                    GameScene.Add(Blob.Seed(cell, 4, typeof(Fire)));
                }
                else
                {
                    base.OnThrow(cell);
                }
            }
            else
            {
                if (!CurUser.Shoot(enemy, this))
                {
                    Dungeon.Level.Drop(this, cell).Sprite.Drop();
                }
            }
        }
Esempio n. 28
0
        public Boundary(Vector3 from, Vector3 to, GameObject p, GameScene parent, int damage = 10)
        {
            Parent = parent.Root;
            AddComponent(new BoundaryCollision(p, from, to, damage));

            pos1 = new GameObject();
            pos2 = new GameObject();

            pos1.Parent = parent.Root;
            pos2.Parent = parent.Root;

            pos1.SceneNode.Position += from.Y * Vector3.Up;
            pos1.SceneNode.Position -= from.X * Vector3.Left;

            pos2.SceneNode.Position += to.Y * Vector3.Up;
            pos2.SceneNode.Position -= to.X * Vector3.Left;

            pos1.SceneNode.PositionZ = 1.5f;
            pos2.SceneNode.PositionZ = 1.5f;

            //pos1.AddComponent(new StaticBody(new BoxInfo(new Vector3(5, 5, 5))));
            //pos2.AddComponent(new StaticBody(new BoxInfo(new Vector3(5, 5, 5))));
        }
Esempio n. 29
0
    public static void KillGame()
    {
        if (PersonPot.Control != null)
        {
            PersonPot.Control.ClearAll();
        }

        //ManagerReport.FinishAllReports("NewMap");

        ClassContainer.Destroy();
        BuildsContainer.Destroy();
        PersonObjectContainer.Destroy();
        MeshBatchContainer.Destroy();

        gameScene.QuestManager.ResetNewGame();


        gameScene.Destroy();
        gameScene = null;
        InputMain.Destroy();

        GameController.ResumenInventory1.GameInventory.Delete();
    }
Esempio n. 30
0
        public cTurret(GameScene scene, Vector2f pos) : base(scene, pos)
        {
            this.Bounds.SetDims(new Vector2f(16, 16));
            this.Bounds.SetPosByCenter(pos);

            gun = new cMachineGun(this, 6, "turret-bullet");

            gunFacingDirection = new Vector2f(0.0f, -1.0f);

            shape           = new RectangleShape(new Vector2f(Bounds.dims.X, Bounds.dims.Y));
            shape.Origin    = new Vector2f(Bounds.halfDims.X, Bounds.halfDims.Y);
            shape.FillColor = Color.Green;
            shape.Position  = new Vector2f(pos.X, pos.Y);
            shape.Scale     = new Vector2f(1.0f, 1.0f);

            light                 = new cLight();
            light.Pos             = this.Bounds.center;
            light.Radius          = 100.0f;
            light.LinearizeFactor = 0.8f;
            light.Bleed           = 8.0f;
            light.Color           = new Color(20, 184, 87);
            this.Scene.LightMap.AddStaticLight(light);
        }
Esempio n. 31
0
        public override void Update(double totalMS, double frameMS)
        {
            base.Update(totalMS, frameMS);

            if (Time.Ticks > _time_to_update)
            {
                _time_to_update = Time.Ticks + 100;

                _sb.Clear();
                GameScene scene = Client.Game.GetScene <GameScene>();

                if (IsMinimized && scene != null)
                {
                    _sb.AppendFormat(DEBUG_STRING_0, CUOEnviroment.CurrentRefreshRate, 0, 0, !World.InGame ? 1f : scene.Scale, scene.RenderedObjectsCount);
                    _sb.AppendLine($"- CUO version: {CUOEnviroment.Version}, Client version: {Settings.GlobalSettings.ClientVersion}");
                    //_sb.AppendFormat(DEBUG_STRING_1, Engine.DebugInfo.MobilesRendered, Engine.DebugInfo.ItemsRendered, Engine.DebugInfo.StaticsRendered, Engine.DebugInfo.MultiRendered, Engine.DebugInfo.LandsRendered, Engine.DebugInfo.EffectsRendered);
                    _sb.AppendFormat(DEBUG_STRING_2, World.InGame ? $"{World.Player.X}, {World.Player.Y}, {World.Player.Z}" : "0xFFFF, 0xFFFF, 0", Mouse.Position, SelectedObject.Object is GameObject gobj ? $"{gobj.X}, {gobj.Y}, {gobj.Z}" : "0xFFFF, 0xFFFF, 0");
                    _sb.AppendFormat(DEBUG_STRING_3, ReadObject(SelectedObject.Object));
                }
                else if (scene != null && scene.ScalePos != 5)
                {
                    _sb.AppendFormat(DEBUG_STRING_SMALL, CUOEnviroment.CurrentRefreshRate, !World.InGame ? 1f : scene.Scale);
                }
                else
                {
                    _sb.AppendFormat(DEBUG_STRING_SMALL_NO_ZOOM, CUOEnviroment.CurrentRefreshRate);
                }


                var size = Fonts.Bold.MeasureString(_sb.ToString());

                _trans.Width  = Width = (int)(size.X + 20);
                _trans.Height = Height = (int)(size.Y + 20);

                WantUpdateSize = true;
            }
        }
Esempio n. 32
0
        public MacroCollectionControl(string name, int w, int h)
        {
            CanMove     = true;
            _scrollArea = new ScrollArea(0, 50, w, h, true);
            Add(_scrollArea);


            GameScene scene = CUOEnviroment.Client.GetScene <GameScene>();

            foreach (Macro macro in scene.Macros.GetAllMacros())
            {
                if (macro.Name == name)
                {
                    Macro = macro;

                    break;
                }
            }

            if (Macro == null)
            {
                Macro = Macro.CreateEmptyMacro(name);
                scene.Macros.AppendMacro(Macro);

                CreateCombobox(Macro.FirstNode);
            }
            else
            {
                MacroObject o = Macro.FirstNode;

                while (o != null)
                {
                    CreateCombobox(o);
                    o = o.Right;
                }
            }
        }
Esempio n. 33
0
        protected override void CreateChildren()
        {
            _btnWait                 = new Tool(0, 7, 20, 24);
            _btnWait.ClickAction     = (button) => Dungeon.Hero.Rest(false);
            _btnWait.LongClickAction = (button) =>
            {
                Dungeon.Hero.Rest(true);
                return(true);
            };

            Add(_btnWait);
            _btnSearch             = new Tool(20, 7, 20, 24);
            _btnSearch.ClickAction = (button) => Dungeon.Hero.Search(true);
            Add(_btnSearch);

            _btnInfo             = new Tool(40, 7, 21, 24);
            _btnInfo.ClickAction = (button) => GameScene.SelectCell(Informer);
            Add(_btnInfo);

            _btnResume             = new Tool(61, 7, 21, 24);
            _btnResume.ClickAction = (button) => Dungeon.Hero.Resume();
            Add(_btnResume);

            _btnInventory                 = new Tool(82, 7, 23, 24);
            _btnInventory.ClickAction     = (button) => GameScene.Show(new WndBag(Dungeon.Hero.Belongings.Backpack, null, WndBag.Mode.ALL, null));
            _btnInventory.LongClickAction = (button) =>
            {
                GameScene.Show(new WndCatalogus()); return(true);
            };

            //Override protected void createChildren() { base.createChildren(); gold = new GoldIndicator(); Add(gold); }; Override protected void layout() { base.layout(); gold.Fill(this); };
            Add(_btnInventory);

            Add(_btnQuick = new QuickslotTool(105, 7, 22, 24));

            Add(_pickedUp = new PickedUpItem());
        }
Esempio n. 34
0
        public void statusCheckTick(object sender, EventArgs e)
        {
            //Process[] pname = Process.GetProcesses();

            /*
             * Process[] pname = Process.GetProcessesByName("pythonw");
             * if (pname.Length > 0)
             * {
             *      pySSSMQStatus2.Text = "PySSSMQ-Server: RUNNING";
             * }
             * else
             * {
             *      pySSSMQStatus2.Text = "PySSSMQ-Server: NOT RUNNING";
             * }*/

            if (krpc != null)
            {
                GameScene Scn   = krpc.CurrentGameScene;
                string    scene = Scn.ToString();
                gameScene.Text = "GAME SCENE: " + scene;

                if (streamCollection != null)
                {
                    streamCollection.setGameScene(Scn);
                }
            }

            // AGC STATUS CHECK
            if (agc.isRunning())
            {
                AGCStatus.Text = "AGC: RUNNING";
            }
            else
            {
                AGCStatus.Text = "AGC: NOT RUNNING";
            }
        }
Esempio n. 35
0
        protected override void OnMouseUp(int x, int y, MouseButton button)
        {
            if (button != MouseButton.Left)
            {
                return;
            }

            GameScene gs = Engine.SceneManager.GetScene <GameScene>();

            if (!gs.IsHoldingItem || !gs.IsMouseOverUI)
            {
                return;
            }

            if (Item.Layer == Layer.Backpack || !Item.OnGround || Item.Distance < Constants.DRAG_ITEMS_DISTANCE)
            {
                SelectedObject.Object = Item;
                gs.DropHeldItemToContainer(Item, x, y);
            }
            else
            {
                gs.Audio.PlaySound(0x0051);
            }
        }
Esempio n. 36
0
        public override void Interact()
        {
            Sprite.TurnTo(pos, Dungeon.Hero.pos);
            if (Quest.Given)
            {
                var tokens = Dungeon.Hero.Belongings.GetItem <DwarfToken>();
                if (tokens != null && (tokens.Quantity() >= 8 || (!Quest.Alternative && tokens.Quantity() >= 6)))
                {
                    GameScene.Show(new WndImp(this, tokens));
                }
                else
                {
                    Tell(Quest.Alternative ? TxtMonks2 : TxtGolems2, Dungeon.Hero.ClassName());
                }
            }
            else
            {
                Tell(Quest.Alternative ? TxtMonks1 : TxtGolems1);
                Quest.Given       = true;
                Quest.IsCompleted = false;

                Journal.Add(Journal.Feature.IMP);
            }
        }
Esempio n. 37
0
        public void loadNewScene()
        {
            GameScene old = currentScene;

            switch (currentState)
            {
            case State.MAIN_MENU:
                currentScene = new MainMenu(this);
                break;

            case State.CAR_BUILDER:
                currentScene = new CarBuilder(this);
                break;

            case State.GAME:
                currentScene = new CarGame(this);
                break;
            }

            requestedChangeState = false;

            currentScene.Load();
            old.Destroy();
        }
Esempio n. 38
0
        private void Form1_Load(object sender, EventArgs e)
        {
            mainGameEnginePanel = new MainGameEnginePanel(this, gamePanelSize, new Point(0, 0));
            gameManager         = new GameManager(this, mainGameEnginePanel);

            WallGameObject wall1 = new WallGameObject(gameManager, new Point(0, 0));

            List <WallGameObject> walls = CreateStartupWalls();

            GameScene gameScene1 = new GameScene(walls.ToList <GameObject>());

            gameManager.AddScene(gameScene1);

            player = new Player(gameManager, new Point(100, 100));
            gameManager.AddGameObjectToScene(player, 0);

            UiManager gameUi1 = new UiManager();

            gameManager.AddUi(gameUi1);

            gameManager.Tick += GameManager_Tick;

            ConnectionStateLabel.Text = "Not connected";
        }
Esempio n. 39
0
        public override void Execute(Hero hero, string action)
        {
            if (action.Equals(AcDisenchant))
            {
                if (hero.Belongings.Weapon == this)
                {
                    DisenchantEquipped     = true;
                    hero.Belongings.Weapon = null;
                    UpdateQuickslot();
                }
                else
                {
                    DisenchantEquipped = false;
                    Detach(hero.Belongings.Backpack);
                }

                CurUser = hero;
                GameScene.SelectItem(itemSelector, WndBag.Mode.WAND, TxtSelectWand);
            }
            else
            {
                base.Execute(hero, action);
            }
        }
Esempio n. 40
0
    //创建新单位CreateHaloEntity
    public void CreateSceneItem(GameScene gs, Protomsg.SceneItemDatas data)
    {
        //

        var clientitem = ExcelManager.Instance.GetItemManager().GetItemByID(data.TypeID);

        if (clientitem == null)
        {
            return;
        }

        GameObject hero = (GameObject)(GameObject.Instantiate(Resources.Load("Item/prefabs/itemprefabs")));

        hero.transform.parent        = gs.transform;
        hero.transform.localPosition = new Vector3(data.X, 0.1f, data.Y);
        //Material mat = Resources.Load<Material>("Item/itemMa");
        //mat.mainTexture = Resources.Load<Texture>(clientitem.SceneItem);
        //hero.GetComponent<MeshRenderer>().materials[0] = mat;

        hero.transform.Find("words").GetComponent <ItemName>().LoadName(clientitem.Name);

        //hero.GetComponent<>
        m_SceneItems[data.ID] = hero;
    }
Esempio n. 41
0
        protected internal override bool AffectHero(Hero hero)
        {
            Sample.Instance.Play(Assets.SND_DRINK);
            Emitter.Parent.Add(new Identification(DungeonTilemap.TileCenterToWorld(Pos)));

            hero.Belongings.Observe();

            for (var i = 0; i < Level.Length; i++)
            {
                var terr = Dungeon.Level.map[i];

                if ((Terrain.Flags[terr] & Terrain.SECRET) == 0)
                {
                    continue;
                }

                Level.Set(i, Terrain.discover(terr));
                GameScene.UpdateMap(i);

                if (Dungeon.Visible[i])
                {
                    GameScene.DiscoverTile(i, terr);
                }
            }

            Buff.Affect <Awareness>(hero, Awareness.Duration);
            Dungeon.Observe();

            Dungeon.Hero.Interrupt();

            GLog.Positive(TXT_PROCCED);

            Journal.Remove(Journal.Feature.WELL_OF_AWARENESS);

            return(true);
        }
Esempio n. 42
0
        public virtual void Add(State state)
        {
            switch (state)
            {
            case State.Burning:
                Burning = Emitter();
                Burning.Pour(FlameParticle.Factory, 0.06f);
                if (Visible)
                {
                    Sample.Instance.Play(Assets.SND_BURNING);
                }
                break;

            case State.Levitating:
                Levitation = Emitter();
                Levitation.Pour(Speck.Factory(Speck.JET), 0.02f);
                break;

            case State.Invisible:
                PotionOfInvisibility.Melt(Ch);
                break;

            case State.Paralysed:
                paused = true;
                break;

            case State.Frozen:
                IceBlock = IceBlock.Freeze(this);
                paused   = true;
                break;

            case State.Illuminated:
                GameScene.Effect(Halo = new TorchHalo(this));
                break;
            }
        }
Esempio n. 43
0
        /// <summary>
        /// basic update with adition of droping land mines when reaching target and deciding wether to shot at player
        /// </summary>
        /// <param name="playerPos">The player position.</param>
        ///<seealso cref="Tank.Update(Vector2)"/>
        public override bool Update(Vector2 playerPos)
        {
            //drop landmine if reached target
            if (BasePosition == target)
            {
                //drop landmine
                GameScene.AddLandMine(new RedMine(BasePosition - Dimensions / 2f));

                //calculate new target positon
                target = SetTarget();
            }

            //if this tank can see player shoot and follow him
            if ((BasePosition - playerPos).LengthSquared() <= Math.Pow(viewRange, 2))
            {
                //turn on cannon and call Tank update with player as target
                Cannon.Active = true;
                return(Update(target, playerPos));
            }

            //turn cannon off and call Tank update with the random point(target) as the target
            Cannon.Active = false;
            return(base.Update(target));
        }
Esempio n. 44
0
        protected internal override void OnZap(int cell)
        {
            for (var i = 1; i < Ballistica.Distance - 1; i++)
            {
                var p  = Ballistica.Trace[i];
                var c1 = Dungeon.Level.map[p];

                if (c1 == Terrain.EMPTY || c1 == Terrain.EMBERS || c1 == Terrain.EMPTY_DECO)
                {
                    levels.Level.Set(p, Terrain.GRASS);
                }
            }

            var c = Dungeon.Level.map[cell];

            if (c == Terrain.EMPTY || c == Terrain.EMBERS || c == Terrain.EMPTY_DECO || c == Terrain.GRASS || c == Terrain.HIGH_GRASS)
            {
                GameScene.Add(Blob.Seed(cell, (Level + 2) * 20, typeof(Regrowth)));
            }
            else
            {
                GLog.Information("nothing happened");
            }
        }
Esempio n. 45
0
    /// <summary>
    /// Is here bz the rotation on the reverse Route needs to be corrected again
    /// </summary>
    void DefineInversedRouteRot()
    {
        if (_routePoins[0].InverseWasSet)//means was setup already once
        {
            return;
        }

        GameScene.dummyBlue.transform.position = _routePoins[_currentRoutePoint].Point;
        _routePoins[0].InverseWasSet           = true;//only the first one is marked as bool

        for (int i = _currentRoutePoint; i > 0; i--)
        {
            //so it doesnt tilt when going up or down the brdige hill
            //im putting in the same height on Y as the next point
            var nexPos = new Vector3(_routePoins[i].Point.x, _routePoins[i - 1].Point.y, _routePoins[i].Point.z);
            GameScene.dummyBlue.transform.position = nexPos;

            GameScene.dummyBlue.transform.LookAt(_routePoins[i - 1].Point);
            _routePoins[i].QuaterniRotationInv = GameScene.dummyBlue.transform.rotation;
        }

        GameScene.ResetDummyBlue();
        //PersonPot.Control.RoutesCache1.AddReplaceRoute(_currTheRoute);
    }
Esempio n. 46
0
        public void Collect(Point position)
        {
            bool collected = false;

            for (int i = 0; i < Diamonds.Count; i++)
            {
                if (Diamonds[i].Position == position)
                {
                    Diamonds.RemoveAt(i);
                    data[position.X, position.Y].Type = TileType.Floor;
                    collected = true;
                    SoundManager.PlaySound("Diamond");
                    break;
                }
            }

            if (collected)
            {
                if (Diamonds.Count == 0)
                {
                    SceneManager sceneManager = GameCore.Instance.SceneManager;
                    if (!string.IsNullOrWhiteSpace(NextLevel))
                    {
                        GameScene gameScene = sceneManager.GetScene <GameScene>();
                        gameScene.CurrentLevel = NextLevel;
                        sceneManager.SetScene <GameScene>();
                    }
                    else
                    {
                        sceneManager.SetScene <CompletionScene>();
                    }
                }

                UpdateDistances();
            }
        }
Esempio n. 47
0
        /// <summary>
        ///
        /// </summary>
        protected override void Initialize()
        {
            base.Initialize();

            Scene.setDefaultDesignResolution(Screen.monitorWidth, Screen.monitorHeight, Scene.SceneResolutionPolicy.NoBorder);

            StartScreenUIScene startSceneUI = new StartScreenUIScene();
            TestScene2         gameScene    = new TestScene2(Core.graphicsDevice);

            SettingsUI settings      = new SettingsUI();
            GameScene  testGameScene = new GameScene();

            MainSceneManager mainManager = new MainSceneManager(gameScene, startSceneUI, false);



            startSceneUI.attachManager(mainManager);

            this.sceneManager = mainManager;



            Screen.isFullscreen = true;
        }
Esempio n. 48
0
        /// <summary>
        /// Initialize to implement per main type.
        /// </summary>
        override public void Initialize()
        {
            // create a new empty scene
            GameScene scene = new GameScene();

            // Init ui
            InitUI(scene);

            // create camera
            InitCamera(scene);

            // Init background and music
            InitAmbience(scene);

            // create meteors and explosions prototype
            InitAsteroids(scene);
            InitExplosions();

            // create the player
            InitPlayer(scene);

            // set to default top-down controls
            Managers.GameInput.SetDefaultTopDownControls();

            // add diagnostic data paragraph to scene
            var diagnosticData = new GeonBit.UI.Entities.Paragraph("", GeonBit.UI.Entities.Anchor.BottomLeft, offset: Vector2.One * 10f, scale: 0.7f);

            diagnosticData.BeforeDraw = (GeonBit.UI.Entities.Entity entity) =>
            {
                diagnosticData.Text = Managers.Diagnostic.GetReportString();
            };
            scene.UserInterface.AddEntity(diagnosticData);

            // load our scene (eg make it active)
            scene.Load();
        }
Esempio n. 49
0
    public override void execute()
    {
        GameScene gameScene = mReceiver as GameScene;
        // 准备时间必须大于0
        SceneProcedure curProcedure = gameScene.getCurSceneProcedure();

        if (mPrepareTime <= 0.0f)
        {
            UnityUtility.logError("preapare time must be larger than 0!");
        }
        // 正在准备跳转时,不允许再次准备跳转
        else if (curProcedure.isPreparingExit())
        {
            UnityUtility.logError("procedure is preparing to exit, can not prepare again!");
        }
        else
        {
            gameScene.prepareChangeProcedure(mProcedure, mPrepareTime, mIntent);
            if (mFrameLogSystem != null)
            {
                mFrameLogSystem.logProcedure("准备进入流程 : " + mProcedure.ToString());
            }
        }
    }
Esempio n. 50
0
    void Awake()
    {
        if (_instance == null)
        {
            _instance = this;
            DontDestroyOnLoad(this);

            //_dotaScene = UIUtil.GetChildByName<Transform>(gameObject, "DotaScene").gameObject;
            //_townScene = UIUtil.GetChildByName<Transform>(gameObject, "TownScene").gameObject;

            //_townScene.AddComponent<TouchWatcher>();
            //_townScene.AddComponent<HollUI>();
            //CameraDrag dragger = _townScene.AddComponent<CameraDrag>();

            //Layout_CameraControl layout_control = UIUtil.GetChildByName<Layout_CameraControl>(gameObject, "Main Camera Delegate");
            //CameraControl control = layout_control.gameObject.AddComponent<CameraControl>();
            //control.layout = layout_control;
            //control.dragger = dragger;
        }
        else
        {
            Destroy(this);
        }
    }
Esempio n. 51
0
        public override int Proc(Armor armor, Character attacker, Character defender, int damage)
        {
            var level = Math.Max(0, armor.level);

            if (pdsharp.utils.Random.Int(level / 2 + 6) < 5)
            {
                return(damage);
            }

            var respawnPoints = new List <int>();

            for (var i = 0; i < Level.NEIGHBOURS8.Length; i++)
            {
                var p = defender.pos + Level.NEIGHBOURS8[i];
                if (Actor.FindChar(p) == null && (Level.passable[p] || Level.avoid[p]))
                {
                    respawnPoints.Add(p);
                }
            }

            if (respawnPoints.Count <= 0)
            {
                return(damage);
            }

            var mob = new MirrorImage();

            mob.Duplicate((Hero)defender);
            GameScene.Add(mob);
            WandOfBlink.Appear(mob, pdsharp.utils.Random.Element(respawnPoints));

            defender.Damage(pdsharp.utils.Random.IntRange(1, defender.HT / 6), this); //attacker
            CheckOwner(defender);

            return(damage);
        }
Esempio n. 52
0
    /// <summary>
    /// 创建一个基础的Region对象
    /// </summary>
    /// <param name="scene"></param>
    /// <param name="regionX"></param>
    /// <param name="regionY"></param>
    /// <returns></returns>
    public static Region Create(GameScene scene, int regionX, int regionY)
    {
        Region region = new Region();

        region.scene          = scene;
        region.tiles          = new Tile[scene.terrainConfig.tileCountPerRegion];
        region.regionX        = regionX;
        region.regionY        = regionY;
        region.regionDataPath = string.Concat(new object[]
        {
            "Scenes/",
            scene.sceneID,
            "/",
            regionX,
            "_",
            regionY,
            "/Region"
        });
        region.actualX   = (float)(regionX * scene.terrainConfig.regionSize);
        region.actualY   = (float)(regionY * scene.terrainConfig.regionSize);
        region.postion   = Vector3.zero;
        region.postion.x = region.actualX;
        region.postion.y = 0f;
        region.postion.z = region.actualY;
        int num = Mathf.FloorToInt((float)scene.terrainConfig.tileCountPerSide * 0.5f);

        for (int i = 0; i < scene.terrainConfig.tileCountPerSide; i++)
        {
            for (int j = 0; j < scene.terrainConfig.tileCountPerSide; j++)
            {
                Tile tile = Tile.Create(region, i - num, j - num);
                region.tiles[j * scene.terrainConfig.tileCountPerSide + i] = tile;
            }
        }
        return(region);
    }
        protected override void LoadContent()
        {
            if (!TextureManager.ContainsTexture("merchant"))
            {
                TextureManager.AddTexture("merchant", GameRef.Content.Load <Texture2D>(@"Backgrounds\merchant-overlay"));
            }

            if (!TextureManager.ContainsTexture("scene-background"))
            {
                TextureManager.AddTexture("scene-background", GameRef.Content.Load <Texture2D>(@"Scenes\scenebackground"));
            }

            _merchantFont = GameRef.Content.Load <SpriteFont>(@"Fonts\Sansation_Light");
            _sceneFont    = GameRef.Content.Load <SpriteFont>(@"Fonts\Sansation_Light");

            _selected = GameRef.Content.Load <Texture2D>(@"Misc\selected");

            if (GameScene.Selected == null)
            {
                GameScene.Load(GameRef);
            }

            base.LoadContent();
        }
Esempio n. 54
0
        private void ReceiveMail(S.ReceiveMail p)
        {
            NewMail        = false;
            NewMailCounter = 0;
            User.Mail.Clear();

            User.Mail = p.Mail.OrderByDescending(e => !e.Locked).ThenByDescending(e => e.DateSent).ToList();

            foreach (ClientMail mail in User.Mail)
            {
                foreach (UserItem itm in mail.Items)
                {
                    GameScene.Bind(itm);
                }
            }

            //display new mail received
            if (User.Mail.Any(e => e.Opened == false))
            {
                NewMail = true;
            }

            GameScene.Scene.MailListDialog.UpdateInterface();
        }
Esempio n. 55
0
 protected void ShowScene(GameScene scene)
 {
     _activeScene.Hide();
     _activeScene = scene;
     scene.Show();
 }
Esempio n. 56
0
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            _spriteBatch = new SpriteBatch(_graphics.GraphicsDevice);
            Services.AddService(typeof(SpriteBatch), _spriteBatch);

            _audio = new AudioLibrary();
            _audio.LoadContent(this.Content);
            Services.AddService(typeof(AudioLibrary), _audio);

            helpBackgroundTexture = Content.Load<Texture2D>("helpbackground");
            helpForegroundTexture = Content.Load<Texture2D>("helpforeground");
            _helpScene = new HelpScene(this, helpBackgroundTexture, helpForegroundTexture);
            Components.Add(_helpScene);

            // Create the Start scene
            smallFont = Content.Load<SpriteFont>("menuSmall");
            largeFont = Content.Load<SpriteFont>("menuLarge");
            startBackgroundTexture = Content.Load<Texture2D>("startBackground");
            startElementsTexture = Content.Load<Texture2D>("startSceneElements");
            _startScene = new StartScene(this, smallFont, largeFont, startBackgroundTexture, startElementsTexture);
            Components.Add(_startScene);
            _creditScene = new CreditScene(this, smallFont, largeFont, startBackgroundTexture, startElementsTexture);
            Components.Add(_creditScene);

            actionElementsTexture = Content.Load<Texture2D>("rockrainenhanced");
            actionBackgroundTexture = Content.Load<Texture2D>("spacebackground");
            scoreFont = Content.Load<SpriteFont>("score");
            scoreFont = Content.Load<SpriteFont>("score");
            //_actionScene = new ActionScene(this, actionElementsTexture, actionBackgroundTexture, _scoreFont);
            //Components.Add(_actionScene);

            _joinScene = new JoinScene(this, largeFont, menuControllers);
            Components.Add(_joinScene);
            _startScene.Show();
            _activeScene = _startScene;
        }
Esempio n. 57
0
    private PlayerInfo playerInfo;//玩家信息集合

    public GameManager(GameScene gameSceneManager)
    {
        this.gameClient = GameClient.Instance;
        this.gameSceneManager = gameSceneManager;
        this.playerInfo = Global.Instance.playerInfo;
    }
Esempio n. 58
0
        public override void OnExit()
        {
            base.OnExit();

            HitMeButton.ButtonUpAction -= HandleHitMeButtonButtonUpAction;
            PauseButton.ButtonUpAction -= HandlePauseButtonButtonUpAction;
            QualityManager.MatchScoreDetected -= HandleQualityManagerMatchScoreDetected;
            QualityManager.FailedMatchDetected -= HandleQualityManagerFailedMatchDetected;
            CardManager.Instance.NoMatchesPossibleDetected -= HandleCardManagerInstanceNoMatchesPossibleDetected;
            GameScene.LevelChangeDetected -= HandleGameSceneLevelChangeDetected;
            GroupCrystallonEntity.BreakDetected -= HandleGroupCrystallonEntityBreakDetected;
            PausePanel.QuitButtonPressDetected -= HandlePausePanelQuitButtonPressDetected;
            PausePanel.ResetButtonPressDetected -= HandlePausePanelResetButtonPressDetected;
            CubeCrystallonEntity.CubeCompleteDetected -= HandleCubeCrystallonEntityCubeCompleteDetected;
            CardManager.Instance.CardSpawned -= HandleCardManagerInstanceCardSpawned;
            if(GameScene.currentLevel == 999) {
                GameTimer.BarEmptied -= HandleGameTimerBarEmptied;
                GameTimer.BarFilled -= HandleGameTimerBarFilled;
                if (BonusBar != null) {
                    BonusBar.BarFilled -= HandleBonusBarBarFilled;
                    BonusBar.BarEmptied -= HandleBonusBarBarEmptied;
                }
                (_nextLevelPanel as InfiniteModeEndPanel).RetryDetected -= HandlePausePanelResetButtonPressDetected;
                (_nextLevelPanel as InfiniteModeEndPanel).QuitDetected -= Handle_nextLevelPanelQuitButtonPressDetected;
            } else {
                (_nextLevelPanel as NextLevelPanel).ReplayDetected -= HandlePausePanelResetButtonPressDetected;
                (_nextLevelPanel as NextLevelPanel).NextLevelDetected -= Handle_nextLevelPanelButtonButtonUpAction;
                (_nextLevelPanel as NextLevelPanel).QuitDetected -= Handle_nextLevelPanelQuitButtonPressDetected;
                (_nextLevelPanel as NextLevelPanel).LevelSelectDetected -= Handle_nextLevelPanelLevelSelectDetected;
            }

            _nextLevelPanel = null;
            HitMeButton = null;
            PauseButton = null;
            pausePanel = null;
            levelTitle = null;
            _messagePanel = null;
            _scene = null;

            #if METRICS
            if(ExitCode == LevelExitCode.NULL){
                DataStorage.CollectMetrics();
            }
            DataStorage.RemoveMetric("Goal");
            DataStorage.RemoveMetric("Score");
            DataStorage.RemoveMetric("Time");
            DataStorage.RemoveMetric("No-Match Time");
            DataStorage.RemoveMetric("Met-Goal Time");
            DataStorage.RemoveMetric("Breaks");
            DataStorage.RemoveMetric("Hit Me");
            DataStorage.RemoveMetric("Exit Code");
            #endif
        }
Esempio n. 59
0
    // Use this for initialization
    void Start()
    {
        shipExplodeAnim = GetComponent<Animator>();
        gameScene = FindObjectOfType<GameScene>();
        sfxManager = FindObjectOfType<SFXManager>();
        wave = gameScene.GetWave();
        difficulty = PlayerPrefsManager.GetDifficulty();
        DetermineHealth();

        string gameMode = PlayerPrefsManager.GetGameMode();
        {
            if(gameMode == "Boss")
            {
                repeatFireRate = 2.0f - (0.1f * wave);
            }
            else
            {
                repeatFireRate = 2.0f - (0.01f * wave);
            }
        }

        InvokeRepeating("NextDestination",0f,1.0f);
        InvokeRepeating("EnemyFire",0f,repeatFireRate);

        scoreManager = GameObject.FindObjectOfType<ScoreManager>();
    }
Esempio n. 60
0
        public override void Enter()
        {
            models = new Models(Program.Instance.content, Program.Instance.Device);

            var interfaceManager = Program.Instance.InterfaceManager;

            interfaceManager.Add(new WorldSceneControl(interfaceManager, Program.Instance.content)
            {
                Scene = GameScene = new GameScene(Program.Instance),
                Size = ((Control)interfaceManager.Root).Size
            });
            GameScene.Camera = new LookatCamera(Program.Instance);

            HUD = new Client.Interface.HUD(interfaceManager)
            {
                Position = new Vector3(0, 0, 10)
            };
            interfaceManager.Add(HUD);

            Console.WriteLine("Client inited");

            Program.Instance.KeyDown += new System.Windows.Forms.KeyEventHandler(OnKeyDown);
            Program.Instance.KeyUp += new System.Windows.Forms.KeyEventHandler(OnKeyUp);

            Server.Log.Output += new Action<string>((s) => Console.WriteLine(s));

            var m = Program.Instance.Map;

            worldwidth = m.Width;
            worldheight = m.Height;

            motionSimulation = new Common.Motion.Simulation(0, 0, m.Width, m.Height,
                (x, y) => { return Common.Math.GetHeight(m.Heightmap, m.Width, m.Height, new SlimDX.Vector3(x, y, 0)); });

            foreach (Common.Entities.Prop prop in m.PropEntities)
            {
                GameScene.Add(new WorldEntity()
                {
                    Model = models.GetModel(m.PropClasses[prop.Class].Model),
                    Translation = prop.Position,
                    Rotation = Quaternion.RotationAxis(Vector3.UnitZ, prop.Rotation),
                    Scale = new Vector3(prop.Scale, prop.Scale, prop.Scale),
                    Name = prop.Name,
                });
                motionSimulation.CreateStatic(prop.Position, prop.Rotation, prop.Scale, m.PropClasses[prop.Class].CollisionRadius);
            }

            SlimDX.Direct3D9.Mesh ground_mesh = Ground.CreateMesh(Program.Instance.Device, m);
            ground_mesh.ComputeNormals();
            GameScene.View.content.Register("groundmesh", ground_mesh);

            terrainTexture = Program.Instance.content.Get<Texture>("ground.jpg");
            //terrainTexture = Program.Instance.content.Get<Texture>("robber1.png");

            GameScene.Add(new WorldEntity()
            {
                Model = new Model()
                {
                    XMesh = ground_mesh,
                    Texture = terrainTexture,
                    IsBillboard = false,
                    Effect = Program.Instance.content.Get<SlimDX.Direct3D9.Effect>("ground.fx")
                }
            });

            GameState.InitTextures();
        }