Exemplo n.º 1
0
 private void Start()
 {
     if (Object.op_Inequality((Object)this.ResetButton, (Object)null))
     {
         // ISSUE: method pointer
         ((UnityEvent)this.ResetButton.get_onClick()).AddListener(new UnityAction((object)this, __methodptr(Reset)));
     }
     if (!string.IsNullOrEmpty(this.TargetObjID))
     {
         this.TargetObj = GameObjectID.FindGameObject(this.TargetObjID);
     }
     if (!string.IsNullOrEmpty(this.SillObjID))
     {
         this.SillObj = GameObjectID.FindGameObject(this.SillObjID);
     }
     this.wid  = (float)(Screen.get_width() / 5);
     this.hei  = (float)(Screen.get_height() / 5);
     this.diag = Mathf.Sqrt(Mathf.Pow(this.wid, 2f) + Mathf.Pow(this.hei, 2f));
     if (Object.op_Inequality((Object)this.TargetObj, (Object)null))
     {
         this.targetScale = this.TargetObj.get_transform().get_localScale();
     }
     if (!Object.op_Inequality((Object)this.SillObj, (Object)null))
     {
         return;
     }
     this.sillScale = this.SillObj.get_transform().get_localScale();
 }
Exemplo n.º 2
0
        private void State_Setup()
        {
            GameObject gameObject = GameObjectID.FindGameObject("UI_TREASURE");

            if (UnityEngine.Object.op_Equality((UnityEngine.Object)gameObject, (UnityEngine.Object)null))
            {
                Debug.LogError((object)"UI_TREASUREが見つかりませんでした。");
            }
            else
            {
                this.m_TargetRect = gameObject.get_transform() as RectTransform;
            }
            DataSource.Bind <ItemParam>(((Component)this).get_gameObject(), this.m_DropItem.param);
            if ((bool)this.m_DropItem.is_secret)
            {
                ItemIcon component = (ItemIcon)((Component)this).get_gameObject().GetComponent <ItemIcon>();
                if (UnityEngine.Object.op_Inequality((UnityEngine.Object)component, (UnityEngine.Object)null))
                {
                    component.IsSecret = true;
                }
            }
            GameParameter.UpdateAll(((Component)this).get_gameObject());
            this.m_ItemIcon = (ItemIcon)((Component)this).get_gameObject().GetComponent <ItemIcon>();
            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.m_ItemIcon, (UnityEngine.Object)null))
            {
                this.m_ItemIcon.Num.set_text(this.m_DropItem.num.ToString());
            }
            ((Component)this).get_transform().set_localScale(new Vector3(0.3f, 0.3f, 1f));
            ((Component)this).get_transform().set_position(new Vector3((float)((Component)this).get_transform().get_position().x, (float)(((Component)this).get_transform().get_position().y + 25.0), (float)((Component)this).get_transform().get_position().z));
            this.m_EndAnimator = (Animator)gameObject.GetComponent <Animator>();
            this.m_State       = DropItemEffect.State.OPEN;
        }
Exemplo n.º 3
0
 public override void OnActivate(int pinID)
 {
     if (pinID != 0)
     {
         return;
     }
     if (Network.Mode == Network.EConnectMode.Offline)
     {
         this.Success();
     }
     else
     {
         GameObject gameObject1 = GameObjectID.FindGameObject(this.HikkoshiFgGMailAddress);
         GameObject gameObject2 = GameObjectID.FindGameObject(this.HikkoshiFgGPassword);
         InputField component1;
         if (Object.op_Equality((Object)gameObject1, (Object)null) || Object.op_Equality((Object)(component1 = (InputField)gameObject1.GetComponent <InputField>()), (Object)null))
         {
             DebugUtility.LogError("InputField doesn't exist.");
         }
         else
         {
             InputField component2;
             if (Object.op_Equality((Object)gameObject2, (Object)null) || Object.op_Equality((Object)(component2 = (InputField)gameObject2.GetComponent <InputField>()), (Object)null))
             {
                 DebugUtility.LogError("InputField doesn't exist.");
             }
             else
             {
                 this.ExecRequest((WebAPI) new ReqGAuthFgGDevice(SystemInfo.get_deviceUniqueIdentifier(), component1.get_text(), component2.get_text(), new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback)));
                 ((Behaviour)this).set_enabled(true);
                 this.m_Api = FlowNode_ReqFggDevice.API.Add;
             }
         }
     }
 }
Exemplo n.º 4
0
        private void StartSuikomi()
        {
            this.mSuikomiStarted = true;
            GameObject gameObject = GameObjectID.FindGameObject("UI_TREASURE");

            if (Object.op_Equality((Object)gameObject, (Object)null))
            {
                Debug.LogError((object)"UI_TREASUREが見つかりませんでした。");
            }
            else
            {
                this.mTargetRect = gameObject.get_transform() as RectTransform;
            }
            DataSource.Bind <ItemParam>(((Component)this).get_gameObject(), this.mDropItem.param);
            GameParameter.UpdateAll(((Component)this).get_gameObject());
            this.mItemIcon = (ItemIcon)((Component)this).get_gameObject().GetComponent <ItemIcon>();
            if (Object.op_Inequality((Object)this.mItemIcon, (Object)null))
            {
                this.mItemIcon.Num.set_text(this.mDropItem.num.ToString());
            }
            ((Component)this).get_transform().set_localScale(new Vector3(0.3f, 0.3f, 1f));
            ((Component)this).get_transform().set_position(new Vector3((float)((Component)this).get_transform().get_position().x, (float)(((Component)this).get_transform().get_position().y + 25.0), (float)((Component)this).get_transform().get_position().z));
            this.mEndAnimator = (Animator)gameObject.GetComponent <Animator>();
            this.mEndAnimator.SetBool("open", false);
        }
Exemplo n.º 5
0
        private void Start()
        {
            this.mResetScrollPos = true;
            if (this.SyncScrollWith.Count == 0 && !string.IsNullOrEmpty(this.SyncScrollWithID))
            {
                GameObject[] gameObjects = GameObjectID.FindGameObjects(this.SyncScrollWithID);
                if (gameObjects != null)
                {
                    foreach (GameObject gameObject in gameObjects)
                    {
                        this.SyncScrollWith.Add((GiziScroll)gameObject.GetComponent <GiziScroll>());
                    }
                }
            }
            Canvas component = (Canvas)((Component)this).get_gameObject().GetComponent <Canvas>();

            if (!Object.op_Inequality((Object)component, (Object)null))
            {
                return;
            }
            Rect pixelRect = component.get_pixelRect();

            // ISSUE: explicit reference operation
            this.BGWidth = (float)((double)((Rect)@pixelRect).get_width() / (double)component.get_scaleFactor() + 100.0);
        }
 public override void OnActivate()
 {
     GameObject[] gameObjects = GameObjectID.FindGameObjects(this.ObjectID);
     for (int index = 0; index < gameObjects.Length; ++index)
     {
         if (Object.op_Inequality((Object)gameObjects[index], (Object)null))
         {
             Animation component = (Animation)gameObjects[index].GetComponent <Animation>();
             if (Object.op_Inequality((Object)component, (Object)null))
             {
                 EventAction_AnimateObject.PlayAnimation(component, this.AnimationID);
             }
         }
     }
     for (int index = 0; index < this.Sequence.SpawnedObjects.Count; ++index)
     {
         if (Object.op_Inequality((Object)this.Sequence.SpawnedObjects[index], (Object)null) && ((Object)this.Sequence.SpawnedObjects[index]).get_name() == this.ObjectID)
         {
             Animation component = (Animation)this.Sequence.SpawnedObjects[index].GetComponent <Animation>();
             if (Object.op_Inequality((Object)component, (Object)null))
             {
                 EventAction_AnimateObject.PlayAnimation(component, this.AnimationID);
             }
         }
     }
     this.ActivateNext();
 }
Exemplo n.º 7
0
        public List <GameObject> GetGameObjectList(GameObjectID id)
        {
            List <GameObject> list = new List <GameObject>();

            foreach (var l in map.GetMapList())
            {
                foreach (var obj in l)
                {
                    list.Add(obj);
                }
            }

            list = list.FindAll(c => c.GetID() == id);

            List <GameObject> aliveList = new List <GameObject>();

            foreach (var c in list)
            {
                if (!c.IsDead())
                {
                    aliveList.Add(c);
                }
            }
            return(aliveList);
        }
Exemplo n.º 8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Critter"/> class.
 /// </summary>
 /// <param name="in_id">
 /// Unique identifier for the <see cref="Critter"/>.  Cannot be null.
 /// Must be a <see cref="All.CritterIDs"/>.
 /// </param>
 /// <param name="in_name">Player-friendly name of the <see cref="Critter"/>.  Cannot be null or empty.</param>
 /// <param name="in_description">Player-friendly description of the <see cref="Critter"/>.</param>
 /// <param name="in_comment">Comment of, on, or by the <see cref="Critter"/>.</param>
 /// <param name="in_nativeBiome">The <see cref="Biome"/> in which this <see cref="Critter"/> is most comfortable.</param>
 /// <param name="in_primaryBehavior">The rules that govern how this <see cref="Critter"/> acts.  Cannot be null.</param>
 /// <param name="in_avoids">Any parquets this <see cref="Critter"/> avoids.</param>
 /// <param name="in_seeks">Any parquets this <see cref="Critter"/> seeks.</param>
 public Critter(GameObjectID in_id, string in_name, string in_description, string in_comment,
                GameObjectID in_nativeBiome, Behavior in_primaryBehavior,
                List <GameObjectID> in_avoids = null, List <GameObjectID> in_seeks = null)
     : base(All.CritterIDs, in_id, in_name, in_description, in_comment, in_nativeBiome, in_primaryBehavior, in_avoids, in_seeks)
 {
     Precondition.IsInRange(in_id, All.CritterIDs, nameof(in_id));
 }
Exemplo n.º 9
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Character"/> class.
        /// </summary>
        /// <param name="in_bounds">
        /// The bounds within which the <see cref="Character"/>'s <see cref="GameObjectID"/> is defined.
        /// Must be one of <see cref="All.BeingIDs"/>.
        /// </param>
        /// <param name="in_id">Unique identifier for the <see cref="Character"/>.  Cannot be null.</param>
        /// <param name="in_description">Player-friendly description of the <see cref="Character"/>.</param>
        /// <param name="in_comment">Comment of, on, or by the <see cref="Character"/>.</param>
        /// <param name="in_personalName">Personal name of the <see cref="Character"/>.  Cannot be null or empty.</param>
        /// <param name="in_familyName">Family name of the <see cref="Character"/>.  Cannot be null or empty.</param>
        /// <param name="in_primaryBehavior">The rules that govern how this <see cref="Character"/> acts.  Cannot be null.</param>
        /// <param name="in_avoids">Any parquets this <see cref="Character"/> avoids.</param>
        /// <param name="in_seeks">Any parquets this <see cref="Character"/> seeks.</param>
        /// <param name="in_pronoun">How to refer to this <see cref="Character"/>.</param>
        /// <param name="in_storyCharacterID">A means of identifying this <see cref="Character"/> across multiple shipped game titles.</param>
        /// <param name="in_startingQuests">Any quests this <see cref="Character"/> has to offer or has undertaken.</param>
        /// <param name="in_dialogue">All dialogue this <see cref="Character"/> may say.</param>
        /// <param name="in_startingInventory">Any items this <see cref="Character"/> owns at the outset.</param>
        protected Character(Range <GameObjectID> in_bounds, GameObjectID in_id,
                            string in_personalName, string in_familyName,
                            string in_description, string in_comment, GameObjectID in_nativeBiome,
                            Behavior in_primaryBehavior, List <GameObjectID> in_avoids = null,
                            List <GameObjectID> in_seeks = null, string in_pronoun = DefaultPronoun,
                            string in_storyCharacterID   = "", List <GameObjectID> in_startingQuests      = null,
                            List <string> in_dialogue    = null, List <GameObjectID> in_startingInventory = null)
            : base(in_bounds, in_id, $"{in_personalName} {in_familyName}", in_description, in_comment,
                   in_nativeBiome, in_primaryBehavior, in_avoids, in_seeks)
        {
            var nonNullPronoun   = string.IsNullOrEmpty(in_pronoun) ? DefaultPronoun : in_pronoun;
            var nonNullQuests    = in_startingQuests ?? Enumerable.Empty <GameObjectID>();
            var nonNullInventory = in_startingInventory ?? Enumerable.Empty <GameObjectID>();

            Precondition.AreInRange(nonNullQuests, All.QuestIDs, nameof(in_startingQuests));
            Precondition.AreInRange(nonNullInventory, All.ItemIDs, nameof(in_startingInventory));
            Precondition.IsNotEmpty(in_personalName, nameof(in_personalName));
            Precondition.IsNotEmpty(in_familyName, nameof(in_familyName));

            PersonalName      = in_personalName;
            FamilyName        = in_familyName;
            Pronoun           = nonNullPronoun;
            StoryCharacterID  = in_storyCharacterID;
            StartingQuests    = nonNullQuests.ToList();
            Dialogue          = (in_dialogue ?? Enumerable.Empty <string>()).ToList();
            StartingInventory = nonNullInventory.ToList();
        }
Exemplo n.º 10
0
        // Загружаем уровень
        public void Load(int number, string filename)
        {
            physWorld = new PhysicsWorld();
            ObjList.Clear();

            StreamReader sr = new StreamReader(filename);
            int          n  = Convert.ToInt32(sr.ReadLine());
            int          m  = Convert.ToInt32(sr.ReadLine());

            for (int i = 0; i < n; i++)
            {
                string s = sr.ReadLine();

                for (int j = 0; j < m; j++)
                {
                    GameObjectID obj = (GameObjectID)(Convert.ToInt32(s[j]) - 48);

                    switch (obj)
                    {
                    case GameObjectID.Brick:
                        ObjList.Add(new Brick(this, new System.Drawing.PointF(j * 32, (n - i + 1) * 32)));
                        break;

                    case GameObjectID.Cactus:

                        break;

                    case GameObjectID.Sand:

                        break;

                    case GameObjectID.Steel:

                        break;

                    case GameObjectID.Coin:

                        break;

                    case GameObjectID.Star:

                        break;

                    case GameObjectID.Bird:

                        break;

                    case GameObjectID.Ping:

                        break;

                    case GameObjectID.Player:
                        player = new Player(this, new System.Drawing.PointF(j * 32, (n - i + 1) * 32));
                        ObjList.Add(player);
                        break;
                    }
                }
            }
        }
Exemplo n.º 11
0
 /// <summary>
 /// Attempts to update the block parquet at the given position.
 /// </summary>
 /// <param name="in_blockID">ID for the new block to set.</param>
 /// <param name="in_position">The position to set.</param>
 /// <returns><c>true</c>, if the block was set, <c>false</c> otherwise.</returns>
 public bool TrySetBlockDefinition(GameObjectID in_blockID, Point in_position)
 => IsValidPosition(in_position) &&
 TrySetParquetDefinition(
     _parquetDefintion[in_position.Y, in_position.X].Floor,
     in_blockID,
     _parquetDefintion[in_position.Y, in_position.X].Furnishing,
     _parquetDefintion[in_position.Y, in_position.X].Collectible,
     in_position);
Exemplo n.º 12
0
 /// <summary>
 /// Attempts to update the collectible parquet at the given position.
 /// </summary>
 /// <param name="in_collectibleID">ID for the new collectible to set.</param>
 /// <param name="in_position">The position to set.</param>
 /// <returns><c>true</c>, if the collectible was set, <c>false</c> otherwise.</returns>
 public bool TrySetCollectibleDefinition(GameObjectID in_collectibleID, Point in_position)
 => IsValidPosition(in_position) &&
 TrySetParquetDefinition(
     _parquetDefintion[in_position.Y, in_position.X].Floor,
     _parquetDefintion[in_position.Y, in_position.X].Block,
     _parquetDefintion[in_position.Y, in_position.X].Furnishing,
     in_collectibleID,
     in_position);
Exemplo n.º 13
0
 /// <summary>
 /// Checks if the given <see cref="GameObjectID"/> falls within the given <see cref="Range{T}"/>.
 /// </summary>
 /// <param name="in_id">The identifier to test.</param>
 /// <param name="in_bounds">The range it must fall within.</param>
 /// <param name="in_argumentName">The name of the argument to use in error reporting.</param>
 /// <exception cref="ArgumentOutOfRangeException">When the identifier is not in range.</exception>
 public static void IsInRange(GameObjectID in_id, Range <GameObjectID> in_bounds,
                              string in_argumentName = DefaultArgumentName)
 {
     if (!in_id.IsValidForRange(in_bounds))
     {
         throw new ArgumentOutOfRangeException($"{in_argumentName}: {in_id} is not within {in_bounds}.");
     }
 }
Exemplo n.º 14
0
 /// <summary>
 /// Attempts to update the floor parquet at the given position.
 /// </summary>
 /// <param name="in_floorID">ID for the new floor to set.</param>
 /// <param name="in_position">The position to set.</param>
 /// <returns><c>true</c>, if the floor was set, <c>false</c> otherwise.</returns>
 public bool TrySetFloorDefinition(GameObjectID in_floorID, Point in_position)
 // TODO If you make these nullable in TrySetParquet these calls can besimplified and the validity check postponned
 => IsValidPosition(in_position) &&
 TrySetParquetDefinition(
     in_floorID,
     _parquetDefintion[in_position.Y, in_position.X].Block,
     _parquetDefintion[in_position.Y, in_position.X].Furnishing,
     _parquetDefintion[in_position.Y, in_position.X].Collectible,
     in_position);
Exemplo n.º 15
0
 public Model GetGameObjectModel(GameObjectID gameObjectId)
 {
     if (loadedModels.ContainsKey(gameObjectId))
         return loadedModels[gameObjectId].model;
     else
     {
         throw new Exception("Nieistniejacy model");
     }
 }
Exemplo n.º 16
0
        protected ParquetParent(Range <GameObjectID> in_bounds, GameObjectID in_id, string in_name, string in_description,
                                string in_comment, GameObjectID in_itemID, GameObjectTag in_addsToBiome, GameObjectTag in_addsToRoom)
            : base(in_bounds, in_id, in_name, in_description, in_comment)
        {
            Precondition.IsInRange(in_itemID, All.ItemIDs, nameof(in_itemID));

            ItemID      = in_itemID;
            AddsToBiome = string.IsNullOrEmpty(in_addsToBiome) ? GameObjectTag.None : in_addsToBiome;
            AddsToRoom  = string.IsNullOrEmpty(in_addsToRoom) ? GameObjectTag.None : in_addsToRoom;
        }
Exemplo n.º 17
0
 private void Awake()
 {
     if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.mLeaderSkillDetailButton, (UnityEngine.Object)null))
     {
         // ISSUE: method pointer
         ((UnityEvent)this.mLeaderSkillDetailButton.get_onClick()).AddListener(new UnityAction((object)this, __methodptr(OpenLeaderSkillDetail)));
     }
     this.mPreviewParent = GameObjectID.FindGameObject <Transform>(this.mPreviewParentID);
     this.mBGUnitImage   = GameObjectID.FindGameObject <RawImage>(this.mBGUnitImageID);
 }
Exemplo n.º 18
0
        public static WorldMapController FindInstance(string gameobjectID)
        {
            GameObject gameObject = GameObjectID.FindGameObject(gameobjectID);

            if (Object.op_Inequality((Object)gameObject, (Object)null))
            {
                return((WorldMapController)gameObject.GetComponent <WorldMapController>());
            }
            return((WorldMapController)null);
        }
Exemplo n.º 19
0
        public GameObject GetGameObject(GameObjectID id)
        {
            GameObject find = gameObjectList.Find(c => c.GetID() == id);

            if (find != null && !find.IsDead())
            {
                return(find);
            }
            return(null);
        }
Exemplo n.º 20
0
        private void Start()
        {
            GameObject gameObject = GameObjectID.FindGameObject("UI_GOLD");

            if (Object.op_Inequality((Object)gameObject, (Object)null))
            {
                GameParameter.UpdateAll(gameObject);
            }
            GameUtility.RequireComponent <OneShotParticle>(((Component)this).get_gameObject());
        }
Exemplo n.º 21
0
 /// <summary>
 /// Select a collectible to paint with.
 /// </summary>
 /// <param name="in_collectibleID">The parquet ID to select.  Must represent a valid Collectible.</param>
 public void SetCollectibleToPaint(GameObjectID in_collectibleID)
 {
     if (in_collectibleID.IsValidForRange(All.CollectibleIDs))
     {
         _collectibleToPaint = in_collectibleID;
     }
     else
     {
         Error.Handle($"Cannot paint non-Collectible {in_collectibleID} as if it were a Collectible.");
     }
 }
Exemplo n.º 22
0
 /// <summary>
 /// Select a block to paint with.
 /// </summary>
 /// <param name="in_blockID">The parquet ID to select.  Must represent a valid Block.</param>
 public void SetBlockToPaint(GameObjectID in_blockID)
 {
     if (in_blockID.IsValidForRange(All.BlockIDs))
     {
         _blockToPaint = in_blockID;
     }
     else
     {
         Error.Handle($"Cannot paint non-Block {in_blockID} as if it were a Block.");
     }
 }
Exemplo n.º 23
0
 /// <summary>
 /// Select a furnishing to paint with.
 /// </summary>
 /// <param name="in_furnishingID">The parquet ID to select.  Must represent a valid Furnishing.</param>
 public void SetFurnishingToPaint(GameObjectID in_furnishingID)
 {
     if (in_furnishingID.IsValidForRange(All.FurnishingIDs))
     {
         _furnishingToPaint = in_furnishingID;
     }
     else
     {
         Error.Handle($"Cannot paint non-Furnishing {in_furnishingID} as if it were a Furnishing.");
     }
 }
Exemplo n.º 24
0
        private void Start()
        {
            GameObject gameObject = GameObjectID.FindGameObject("UI_GOLD");

            if (!UnityEngine.Object.op_Equality((UnityEngine.Object)gameObject, (UnityEngine.Object)null))
            {
                this.m_TargetRect = gameObject.get_transform() as RectTransform;
            }
            SceneBattle.SimpleEvent.Send(SceneBattle.TreasureEvent.GROUP, "DropGoldEffect.End", (object)this);
            GameUtility.RequireComponent <OneShotParticle>(((Component)this).get_gameObject());
        }
Exemplo n.º 25
0
 public Floor(GameObjectID in_id, string in_name, string in_description, string in_comment,
              GameObjectID?in_itemID      = null, GameObjectTag?in_addsToBiome    = null,
              GameObjectTag?in_addsToRoom = null, ModificationTools in_modTool    = ModificationTools.None,
              string in_trenchName        = defaultTrenchName, bool in_isWalkable = true)
     : base(Bounds, in_id, in_name, in_description, in_comment, in_itemID ?? GameObjectID.None,
            in_addsToBiome ?? GameObjectTag.None, in_addsToRoom ?? GameObjectTag.None)
 {
     ModTool    = in_modTool;
     TrenchName = in_trenchName;
     IsWalkable = in_isWalkable;
 }
Exemplo n.º 26
0
        public GameObject GetGameObject(GameObjectID id)
        {
            GameObject find = gameObjectList.Find(c => c.GetID() == id);

            //発見したオブジェクトがnull出ないときかつ死んでないとき
            if (find != null && !find.IsDead())
            {
                return(find);
            }
            return(null);
        }
Exemplo n.º 27
0
        public GameObject GetGameObject(GameObjectID id)
        {
            //引数のidがリストのGameObjectにあるか探す
            GameObject find = gameObjectList.Find(c => c.GetID() == id);

            //発見したオブジェクトがnullでない時かつ、死んでないとき
            if (find != null && !find.IsDead())
            {
                return(find);
            }
            return(null);//発見できなかった
        }
Exemplo n.º 28
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ParquetStack"/> struct.
        /// </summary>
        /// <param name="in_floor">The floor-layer parquet.</param>
        /// <param name="in_block">The The floor-layer parquet-layer parquet.</param>
        /// <param name="in_furnishing">The furnishing-layer parquet.</param>
        /// <param name="in_collectible">The collectible-layer parquet.</param>
        public ParquetStack(GameObjectID in_floor, GameObjectID in_block, GameObjectID in_furnishing, GameObjectID in_collectible)
        {
            Precondition.IsInRange(in_floor, All.FloorIDs, nameof(in_floor));
            Precondition.IsInRange(in_block, All.BlockIDs, nameof(in_block));
            Precondition.IsInRange(in_furnishing, All.FurnishingIDs, nameof(in_furnishing));
            Precondition.IsInRange(in_collectible, All.CollectibleIDs, nameof(in_collectible));

            Floor       = in_floor;
            Block       = in_block;
            Furnishing  = in_furnishing;
            Collectible = in_collectible;
        }
Exemplo n.º 29
0
 /// <summary>
 /// Select a floor to paint with.
 /// </summary>
 /// <param name="in_floorID">The parquet ID to select.  Must represent a valid Floor.</param>
 public void SetFloorToPaint(GameObjectID in_floorID)
 {
     //Adds bounds-checking using the Ranges defined in Assembly.
     if (in_floorID.IsValidForRange(All.FloorIDs))
     {
         _floorToPaint = in_floorID;
     }
     else
     {
         Error.Handle($"Cannot paint non-Floor {in_floorID} as if it were a Floor.");
     }
 }
Exemplo n.º 30
0
    public void AddItem(ItemClass itemType, Vector3 addPosition, string itemInfoFromServer)
    {
        if (itemInfoFromServer == null)
        {
            // Instantiate unit and instantiate starting cooldown and player
            ItemClass newItem = Instantiate(itemType, new Vector3(addPosition.x, TileArray[(int)addPosition.x, (int)addPosition.z].tile_elevation, addPosition.z), Quaternion.identity);

            // Create entityID
            newItem.entityID = GameObjectID.CreateID("ITEM");

            // Send item to firebase
            if (GAME_MODE == "multiplayer")
            {
                turnManager.SendMoveToFirebase(PLAYER_TEAM + "|IADD|" + newItem.entityID + "|" + newItem.entityName + "|" + addPosition.x + "|" + addPosition.z);
            }
        }
        else
        {
            string[] aData = itemInfoFromServer.Split('|');

            if (Convert.ToInt32(aData[0]) != PLAYER_TEAM)
            {
                string itemName = aData[3].Replace("(Clone)", "");

                // Determine item type
                switch (itemName)
                {
                case "Health Potion":
                    itemType = itemHealthPotion;
                    break;

                case "Mana Potion":
                    itemType = itemManaPotion;
                    break;
                }

                int xCoord = Convert.ToInt32(aData[4]);
                int zCoord = Convert.ToInt32(aData[5]);

                addPosition.x = xCoord;
                addPosition.y = TileArray[xCoord, zCoord].tile_elevation;
                addPosition.z = zCoord;

                // Instantiate item and set entityID (... might be unnecessary step)
                ItemClass newItem = Instantiate(itemType, addPosition, Quaternion.identity);

                newItem.entityID = aData[2];

                // Set TURN_PROCESSING to false since AdvanceTurn() is not called here
                turnManager.SetTurnProcessingFalse("AddItem from Firebase");
            }
        }
    }
Exemplo n.º 31
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NPC"/> class.
 /// </summary>
 /// <param name="in_id">
 /// Unique identifier for the <see cref="NPC"/>.  Cannot be null.
 /// Must be a valid <see cref="All.NpcIDs"/>.
 /// </param>
 /// <param name="in_personalName">Personal name of the <see cref="NPC"/>.  Cannot be null or empty.</param>
 /// <param name="in_familyName">Family name of the <see cref="NPC"/>.  Cannot be null or empty.</param>
 /// <param name="in_description">Player-friendly description of the <see cref="NPC"/>.</param>
 /// <param name="in_comment">Comment of, on, or by the <see cref="NPC"/>.</param>
 /// <param name="in_nativeBiome">The <see cref="GameObjectID"/> of the <see cref="Biome"/> in which this <see cref="NPC"/> is most comfortable.</param>
 /// <param name="in_currentBehavior">The rules that govern how this <see cref="NPC"/> acts.  Cannot be null.</param>
 /// <param name="in_avoids">Any parquets this <see cref="NPC"/> avoids.</param>
 /// <param name="in_seeks">Any parquets this <see cref="NPC"/> seeks.</param>
 /// <param name="in_pronoun">How to refer to this <see cref="NPC"/>.</param>
 /// <param name="in_storyCharacterID">A means of identifying this <see cref="PlayerCharacter"/> across multiple shipped game titles.</param>
 /// <param name="in_quests">Any quests this <see cref="NPC"/> has to offer.</param>
 /// <param name="in_dialogue">All dialogue this <see cref="NPC"/> may say.</param>
 /// <param name="in_inventory">Any items this <see cref="NPC"/> owns.</param>
 public NPC(GameObjectID in_id, string in_personalName, string in_familyName,
            string in_description, string in_comment,
            GameObjectID in_nativeBiome, Behavior in_currentBehavior,
            List <GameObjectID> in_avoids    = null, List <GameObjectID> in_seeks         = null,
            string in_pronoun                = DefaultPronoun, string in_storyCharacterID = "",
            List <GameObjectID> in_quests    = null, List <string> in_dialogue            = null,
            List <GameObjectID> in_inventory = null)
     : base(All.NpcIDs, in_id, in_personalName, in_familyName, in_description,
            in_comment, in_nativeBiome, in_currentBehavior, in_avoids, in_seeks,
            in_pronoun, in_storyCharacterID, in_quests, in_dialogue, in_inventory)
 {
     Precondition.IsInRange(in_id, All.NpcIDs, nameof(in_id));
 }
Exemplo n.º 32
0
        // Methods
        public InformationMessage(byte[] data)
            : base(data)
        {
            this.slayerType = UnitType.NotApplicable;
            this.charClass = CharacterClass.NotApplicable;
            this.slayerObject = GameObjectID.NotApplicable;
            this.slayerMonster = NPCCode.NotApplicable;
            this.informationType = PlayerInformationActionType.None;
            this.relationType = PlayerRelationActionType.NotApplicable;
            this.amount = -1;
            this.type = (InformationMessageType) data[1];
            this.actionType = data[2];
            switch (this.type)
            {
                case InformationMessageType.DroppedFromGame:
                case InformationMessageType.JoinedGame:
                case InformationMessageType.LeftGame:
                    this.subjectName = ByteConverter.GetNullString(data, 8);
                    this.objectName = ByteConverter.GetNullString(data, 0x18);
                    return;

                case ((InformationMessageType) 1):
                case ((InformationMessageType) 5):
                    break;

                case InformationMessageType.NotInGame:
                    this.subjectName = ByteConverter.GetNullString(data, 8);
                    return;

                case InformationMessageType.PlayerSlain:
                    this.slayerType = (UnitType) data[7];
                    this.subjectName = ByteConverter.GetNullString(data, 8);
                    if (this.slayerType != UnitType.Player)
                    {
                        if (this.slayerType == UnitType.NPC)
                        {
                            this.slayerMonster = (NPCCode) BitConverter.ToUInt32(data, 3);
                            return;
                        }
                        if (this.slayerType == UnitType.GameObject)
                        {
                            this.slayerObject = (GameObjectID) BitConverter.ToUInt32(data, 3);
                            return;
                        }
                        break;
                    }
                    this.charClass = (CharacterClass) BitConverter.ToUInt32(data, 3);
                    this.objectName = ByteConverter.GetNullString(data, 0x18);
                    return;

                case InformationMessageType.PlayerRelation:
                    this.informationType = (PlayerInformationActionType) this.actionType;
                    this.objectUID = BitConverter.ToUInt32(data, 3);
                    this.relationType = (PlayerRelationActionType) data[7];
                    return;

                case InformationMessageType.SoJsSoldToMerchants:
                    this.amount = BitConverter.ToInt32(data, 3);
                    break;

                default:
                    return;
            }
        }
Exemplo n.º 33
0
 // Methods
 public AssignGameObject(byte[] data)
     : base(data)
 {
     this.uid = BitConverter.ToUInt32(data, 2);
     this.objectID = (GameObjectID) BitConverter.ToUInt16(data, 6);
     this.x = BitConverter.ToUInt16(data, 8);
     this.y = BitConverter.ToUInt16(data, 10);
     this.objectMode = (GameObjectMode) data[12];
     if (this.objectID == GameObjectID.TownPortal)
     {
         this.interactType = GameObjectInteractType.TownPortal;
         this.destination = (AreaLevel) data[13];
     }
     else
     {
         this.interactType = (GameObjectInteractType) data[13];
         this.destination = AreaLevel.None;
     }
 }
Exemplo n.º 34
0
 public IEnumerable<Texture2D> GetModelTextures(GameObjectID gameObjectId)
 {
     if (loadedModels.ContainsKey(gameObjectId))
         return loadedModels[gameObjectId].textures;
     else
     {
         throw new Exception("Nieistniejacy model");
     }
 }
Exemplo n.º 35
0
        public GameObject CreateGameObject(GameObjectID gameObjectId)
        {
            GameObject CreatedObject = null;
            ObjectStats.GameObjectStats objectStats = GameObjectStatsReader.GetStatsReader().GetObjectStats(GameContentManager.GameObjectNames[gameObjectId]);

            foreach (ObjectStats.SubElement subElement in objectStats.SubElements)
            {
                //Translacja name <-> GameObjectID
                GameObjectID idOfSubElement = (from ids in GameContentManager.GameObjectNames
                                               where ids.Value == subElement.Name
                                               select ids.Key).First();
                subElement.GameObject = CreateGameObject(idOfSubElement);
            }

            Model loadedModel = GameContentManager.Content.GetGameObjectModel(gameObjectId);
            switch (objectStats.Type)
            {
                case ObjectClass.Vehicle:
                    CreatedObject = new Vehicle(loadedModel, objectStats as ObjectStats.VehicleStats);

                    //Hotffix
                    if (gameObjectId == GameObjectID.Chassy)
                        CreatedObject.Position = new Vector3(100, 0, 80);

                    break;
                case ObjectClass.StaticObject:
                    CreatedObject = new StaticObject(loadedModel, objectStats as ObjectStats.StaticObjectStats);
                    break;
                case ObjectClass.Building:
                    CreatedObject = new Building(loadedModel, objectStats as ObjectStats.BuildingStats);
                    break;
                case ObjectClass.Infantry:
                    CreatedObject = new Infantry(loadedModel, objectStats as ObjectStats.InfantryStats);
                    break;
                case ObjectClass.Civilian:
                    CreatedObject = new Civilian(loadedModel, objectStats as ObjectStats.CivilianStats);
                    break;
            }

            if (CreatedObject != null)
            {
                CreatedObject.Textures = GameContentManager.Content.GetModelTextures(gameObjectId).ToList();

                int i = 0;
                foreach (var model in CreatedObject.Model.Meshes)
                {
                    foreach (Effect effect in model.Effects)
                    {
                        if (CreatedObject.Textures[i++] != null)      //inaczej się kurwa nie dało
                        {
                            effect.CurrentTechnique = effect.Techniques["TexturedShaded"];
                        }
                        else
                        {
                            effect.CurrentTechnique = effect.Techniques["NotRlyTexturedShaded"];
                        }
                    }
                }

                //Wprowadzenie danych materialu - fix buga z Pipelinem
                MaterialReader materialReader = new MaterialReader(CreatedObject, GameContentManager.GameObjectNames[gameObjectId]);
                materialReader.PopulateObject();

                i = 0;
                foreach (var model in CreatedObject.Model.Meshes)
                {
                    foreach (Effect effect in model.Effects)
                    {
                        //Parametry materialu
                        effect.Parameters["xAmbient"].SetValue(CreatedObject.Ambient[i]);
                        effect.Parameters["xDiffuseColor"].SetValue(CreatedObject.DiffuseColor[i]);
                        effect.Parameters["xDiffuseFactor"].SetValue(CreatedObject.DiffuseFactor[i]);

                        effect.Parameters["xTransparency"].SetValue(CreatedObject.Transparency[i]);
                        effect.Parameters["xSpecularColor"].SetValue(CreatedObject.Specular[i]);
                        effect.Parameters["xSpecularFactor"].SetValue(CreatedObject.SpecularFactor[i]);

                        effect.Parameters["xHasTexture"].SetValue(CreatedObject.Textures[i] != null ? true : false);
                        effect.Parameters["xTexture"].SetValue(CreatedObject.Textures[i++]);
                    }
                }

                return CreatedObject;
            }
            else
            {
                throw new Exception("Unknown unit!");
            }

            return null;
        }