Пример #1
0
 private void interactWithObjects()
 {
     for (int i = 0; i < gameobjectsToBeInteracted.Length; i++)
     {
         if (gameobjectsToBeInteracted[i].gameObject is DoorObject)
         {
             //Toggle the door object
             DoorObject puerta = gameobjectsToBeInteracted[i].gameObject.GetComponent <DoorObject>();
             puerta.setState(!puerta.getState());
         }
         else if (gameobjectsToBeInteracted[i].gameObject is MovePlatform)
         {
             //Activate the platform
             MovePlatform plataforma = gameobjectsToBeInteracted[i].gameObject.GetComponent <MovePlatform>();
             if (gameobjectsToBeInteracted[i].gameObject.active)
             {
                 gameobjectsToBeInteracted[i].gameObject.SetActive(false);
             }
             else
             {
                 gameobjectsToBeInteracted[i].gameObject.SetActive(true);
             }
         }
         else if (gameobjectsToBeInteracted[i].gameObject.gameObject is foco)
         {
             //Switch off/on the spotlight
             foco spotlight = gameobjectsToBeInteracted[i].gameObject.GetComponent <foco>();
             //Logica a seguir para los focos
         }
     }
 }
Пример #2
0
        public DoorObject AddDoorObject(int layer)
        {
            DoorObject obj = new DoorObject(
                InitialiseDataForObject(LevelObject.Type.DOOR), (int)GetNextUniqueID(), layer);

            m_LevelObjects.Add(obj.m_UniqueID, obj);
            return(obj);
        }
Пример #3
0
    public void ReturnInteriorDoor(DoorObject door)
    {
        door.SetTilePos(new Vec2Int(-1, -1));
        door.SetMaterial(PrefabAssets.Singleton.doorHologramMat);
        door.gameObject.transform.parent = this.transform;
        door.gameObject.SetActive(false);

        m_intDoorCache.ReturnObject(door);
    }
Пример #4
0
    public void startDialog(DoorObject _doorObj, string levelName)
    {
        doorObj = _doorObj;

        DialogSystem.character nameString = DialogSystem.character.SYSTEM;
        string dialogString = "Go to " + levelName + " ?";

        //dsObj.startDialog(nameString, dialogString);
        optionSelect(nameString, dialogString, 1);
    }
Пример #5
0
    // Use this for initialization
    void Start()
    {
        //初始化赋值
        GameManagerObject = GameObject.FindGameObjectsWithTag("GameManager")[0];
        GameManager       = GameManagerObject.GetComponent <GameManager>();
        PlayerObject      = GameManager.Player;
        TargetPlayer      = PlayerObject.GetComponent <Player>();
        DoorObject        = GameManager.Door;
        Door = DoorObject.GetComponent <Door>();

        /*自身属性赋值*/
        MonsterAnimator  = GetComponent <Animator>();
        MonsterTransform = GetComponent <Transform>();
    }
Пример #6
0
        protected virtual void WriteDoorObjectToXML(XmlWriter writer, DoorObject obj)
        {
            writer.WriteStartElement("DoorObject");
            writer.WriteAttributeString("star", obj.m_Layer.ToString());

            WriteObjectPositionToXML(writer, obj);

            writer.WriteElementString("YRotation", Helper.ToString(obj.YRotation));

            writer.WriteElementString("DoorType", obj.DoorType.ToString());
            writer.WriteElementString("OutAreaID", obj.OutAreaID.ToString());
            writer.WriteElementString("InAreaID", obj.InAreaID.ToString());
            writer.WriteElementString("PlaneSizeX", obj.PlaneSizeX.ToString());
            writer.WriteElementString("PlaneSizeY", obj.PlaneSizeY.ToString());

            writer.WriteEndElement();
        }
Пример #7
0
        protected virtual void ReadDoorObject(XmlReader reader, Level level)
        {
            int layer = int.Parse(reader.GetAttribute("star"));

            DoorObject obj = level.AddDoorObject(layer);

            while (reader.Read())
            {
                reader.MoveToContent();
                if (reader.NodeType.Equals(XmlNodeType.Element) && reader.LocalName.Equals("Position"))
                {
                    Vector3 position = ReadPositionVector3(reader);
                    obj.Position = position;
                }
                else if (reader.NodeType.Equals(XmlNodeType.Element) && reader.LocalName.Equals("YRotation"))
                {
                    float yRotation = Helper.ParseFloat(reader.ReadElementContentAsString());
                    obj.YRotation = yRotation;
                }
                else if (reader.NodeType.Equals(XmlNodeType.Element) && reader.LocalName.Equals("DoorType"))
                {
                    obj.DoorType = reader.ReadElementContentAsInt();
                }
                else if (reader.NodeType.Equals(XmlNodeType.Element) && reader.LocalName.Equals("OutAreaID"))
                {
                    obj.OutAreaID = reader.ReadElementContentAsInt();
                }
                else if (reader.NodeType.Equals(XmlNodeType.Element) && reader.LocalName.Equals("InAreaID"))
                {
                    obj.InAreaID = reader.ReadElementContentAsInt();
                }
                else if (reader.NodeType.Equals(XmlNodeType.Element) && reader.LocalName.Equals("PlaneSizeX"))
                {
                    obj.PlaneSizeX = reader.ReadElementContentAsInt();
                }
                else if (reader.NodeType.Equals(XmlNodeType.Element) && reader.LocalName.Equals("PlaneSizeY"))
                {
                    obj.PlaneSizeY = reader.ReadElementContentAsInt();
                }
                else if (reader.NodeType.Equals(XmlNodeType.EndElement) && reader.LocalName.Equals("DoorObject"))
                {
                    break;
                }
            }
        }
Пример #8
0
        private static void WriteDoorObjectToXML(XmlWriter writer, DoorObject obj)
        {
            writer.WriteStartElement("DoorObject");
            writer.WriteAttributeString("star", obj.m_Layer.ToString());

            writer.WriteStartElement("Position");
            writer.WriteElementString("X", obj.Position.X.ToString(usa));
            writer.WriteElementString("Y", obj.Position.Y.ToString(usa));
            writer.WriteElementString("Z", obj.Position.Z.ToString(usa));
            writer.WriteEndElement();

            writer.WriteElementString("YRotation", obj.YRotation.ToString(usa));

            writer.WriteElementString("DoorType", obj.DoorType.ToString());
            writer.WriteElementString("OutAreaID", obj.OutAreaID.ToString());
            writer.WriteElementString("InAreaID", obj.InAreaID.ToString());
            writer.WriteElementString("PlaneSizeX", obj.PlaneSizeX.ToString());
            writer.WriteElementString("PlaneSizeY", obj.PlaneSizeY.ToString());

            writer.WriteEndElement();
        }
Пример #9
0
    /*移动到城门前,攻击城门*/
    protected void AttackDoor()
    {
        turnLeft();
        Vector3 DoorPosition;

        DoorPosition = DoorObject.GetComponent <Transform>().position;

        float xDistance = this.GetComponent <Transform>().position.x - DoorPosition.x;

        if (xDistance > DoorAttackDistance)
        {
            // 尚未到达大门
            MonsterAnimator.SetBool("isRun", true);
            Vector3 translator = new Vector3(speed, 0.0f, 0.0f);
            MonsterTransform.Translate(translator);
        }
        else
        {
            //已经到达大门处
            MonsterAnimator.SetBool("isRun", false);
            MonsterAnimator.SetTrigger("SwordAttack"); //播放攻击动画
        }
    }
Пример #10
0
        private static void WriteDoorObjectToXML(XmlWriter writer, DoorObject obj)
        {
            writer.WriteStartElement("DoorObject");
            writer.WriteAttributeString("star", obj.m_Layer.ToString());

            writer.WriteStartElement("Position");
            writer.WriteElementString("X", obj.Position.X.ToString(usa));
            writer.WriteElementString("Y", obj.Position.Y.ToString(usa));
            writer.WriteElementString("Z", obj.Position.Z.ToString(usa));
            writer.WriteEndElement();

            writer.WriteElementString("YRotation", obj.YRotation.ToString(usa));

            writer.WriteElementString("DoorType", obj.DoorType.ToString());
            writer.WriteElementString("OutAreaID", obj.OutAreaID.ToString());
            writer.WriteElementString("InAreaID", obj.InAreaID.ToString());
            writer.WriteElementString("PlaneSizeX", obj.PlaneSizeX.ToString());
            writer.WriteElementString("PlaneSizeY", obj.PlaneSizeY.ToString());

            writer.WriteEndElement();
        }
Пример #11
0
        private void ReadObjectTable(NitroOverlay ovl, uint offset, int area)
        {
            uint subtbl_num    = ovl.Read32(offset);
            uint subtbl_offset = ovl.ReadPointer(offset + 0x4);

            for (uint st = 0; st < subtbl_num; st++)
            {
                uint curoffset = subtbl_offset + (st * 8);

                byte flags          = ovl.Read8(curoffset);
                byte entries_num    = ovl.Read8(curoffset + 0x1);
                uint entries_offset = ovl.ReadPointer(curoffset + 0x4);

                byte type  = (byte)(flags & 0x1F);
                byte layer = (byte)(flags >> 5);

                if (type == 11)
                {
                    m_MinimapFileIDs = new ushort[entries_num];
                }

                for (byte e = 0; e < entries_num; ++e)
                {
                    LevelObject    obj;
                    INitroROMBlock objData = new INitroROMBlock();
                    objData.m_Data = ovl.ReadBlock((uint)(entries_offset + e * k_LevelObjTypeSizes[type]), (uint)k_LevelObjTypeSizes[type]);
                    switch (type)
                    {
                    case 0:
                        obj = new StandardObject(objData, m_LevelObjects.Count, layer, area);
                        break;

                    case 1:
                        obj = new EntranceObject(objData, m_LevelObjects.Count, layer, m_EntranceID++);
                        break;

                    case 2:     // Path Node
                        obj = new PathPointObject(objData, m_LevelObjects.Count, m_PathNodeID++);
                        break;

                    case 3:     // Path
                        obj = new PathObject(objData, m_LevelObjects.Count, (ushort)m_PathID++);
                        break;

                    case 4:
                        obj = new ViewObject(objData, m_LevelObjects.Count, m_ViewID++);
                        break;

                    case 5:
                        obj = new SimpleObject(objData, m_LevelObjects.Count, layer, area);
                        break;

                    case 6:
                        obj = new TpSrcObject(objData, m_LevelObjects.Count, layer);
                        break;

                    case 7:
                        obj = new TpDstObject(objData, m_LevelObjects.Count, layer);
                        break;

                    case 8:
                        // Fog
                        obj = new FogObject(objData, m_LevelObjects.Count, layer, area);
                        break;

                    case 9:
                        obj = new DoorObject(objData, m_LevelObjects.Count, layer);
                        break;

                    case 10:
                        obj = new ExitObject(objData, m_LevelObjects.Count, layer);
                        break;

                    case 11:
                        obj = new MinimapTileIDObject(objData, m_LevelObjects.Count, layer, m_MinimapTileIDNum++);
                        // This is still used by Minimap Editor
                        m_MinimapFileIDs[e] = ovl.Read16((uint)(entries_offset + (e * 2)));
                        break;

                    case 12:
                        // per-area minimap scale factors
                        obj = new MinimapScaleObject(objData, m_LevelObjects.Count, layer, area);
                        break;

                    case 14:
                        // ??? Unknown
                        obj = new Type14Object(objData, m_LevelObjects.Count, layer, area);
                        break;

                    default:
                        throw new InvalidDataException("Bad object type: " + type);
                    }

                    m_LevelObjects.Add(obj.m_UniqueID, obj);
                }
            }
        }