Example #1
0
    override public bool Init(ObjectInitParam param)
    {
        GhostInitParam ghostParam = (GhostInitParam)param;

        mGhostData = ghostParam.ghost_data;

        if (!DataManager.PlayerTable.ContainsKey(mGhostData.resId))
        {
            return(false);
        }

        mRes = DataManager.PlayerTable[mGhostData.resId] as PlayerTableItem;

        mModelResID   = mRes.model;
        mMainWeaponID = mGhostData.main_weaponId;
        mMainPlayer   = ghostParam.main_player;

        if (!base.Init(param))
        {
            return(false);
        }

        InitProperty(mGhostData);

        SetLeague(ghostParam.league);

        return(true);
    }
 private void Start()
 {
     if (death == null)
     {
         death = FindObjectOfType <DeathData>();
     }
     if (demon == null)
     {
         demon = FindObjectOfType <DemonData>();
     }
     if (ghost == null)
     {
         ghost = FindObjectOfType <GhostData>();
     }
     if (grunt == null)
     {
         grunt = FindObjectOfType <GruntData>();
     }
     if (lobber == null)
     {
         lobber = FindObjectOfType <LobberData>();
     }
     if (sorcerer == null)
     {
         sorcerer = FindObjectOfType <SorcererData>();
     }
     if (thief == null)
     {
         thief = FindObjectOfType <ThiefData>();
     }
 }
Example #3
0
    public GhostData Decode()
    {
        GhostData rtn = new GhostData();

        rtn.Pos = Pos.V3;
        rtn.Rot = Rot.Decode;
        return(rtn);
    }
Example #4
0
 public override void Configure()
 {
     opt.OptionEntity.entity = String.Format("ghost{0}", concreteIdx);
     Printer.Log(91, "Biome Ghosts: ", this.biome.Ghost);
     this.GhostData = this.biome.Ghost.Gen(Hashes.Rand(this.seed, "ghosttype"));
     this.name      = String.Format("{0}-{1}", this.name, this.GhostData.name);
     Printer.Log(91, "GhostData: ", GhostData);
     Printer.Log(60, "Ghost Configure: done");
 }
Example #5
0
    public void Eaten(string ghostName)
    {
        GhostData theGhost = ghostMap[ghostName];

        theGhost.setRespawn(true);
        theGhost.getGhostAnimator().SetBool("flash", false);
        theGhost.setGhostState(State.CHASE);
        theGhost.getGhostObject().GetComponent <SpriteRenderer>().color = new Color(1, 1, 1, 0.3f);
    }
 public void Load()
 {
     if (File.Exists(Application.dataPath + saveDataFolder + saveFileName_p))
     {
         string readAllText = File.ReadAllText(Application.dataPath + saveDataFolder + saveFileName_p);
         // ghostDataに読み込んだデータを書き込む
         if (pianoData == null)
         {
             pianoData = new GhostData();
         }
         JsonUtility.FromJsonOverwrite(readAllText, pianoData);
     }
     if (File.Exists(Application.dataPath + saveDataFolder + saveFileName_g))
     {
         string readAllText = File.ReadAllText(Application.dataPath + saveDataFolder + saveFileName_g);
         // ghostDataに読み込んだデータを書き込む
         if (guitarData == null)
         {
             guitarData = new GhostData();
         }
         JsonUtility.FromJsonOverwrite(readAllText, guitarData);
     }
     if (File.Exists(Application.dataPath + saveDataFolder + saveFileName_b))
     {
         string readAllText = File.ReadAllText(Application.dataPath + saveDataFolder + saveFileName_b);
         // ghostDataに読み込んだデータを書き込む
         if (bassData == null)
         {
             bassData = new GhostData();
         }
         JsonUtility.FromJsonOverwrite(readAllText, bassData);
     }
     if (File.Exists(Application.dataPath + saveDataFolder + saveFileName_d))
     {
         string readAllText = File.ReadAllText(Application.dataPath + saveDataFolder + saveFileName_d);
         // ghostDataに読み込んだデータを書き込む
         if (drumsData == null)
         {
             drumsData = new GhostData();
         }
         JsonUtility.FromJsonOverwrite(readAllText, drumsData);
     }
     if (File.Exists(Application.dataPath + saveDataFolder + saveFileName_m))
     {
         string readAllText = File.ReadAllText(Application.dataPath + saveDataFolder + saveFileName_m);
         // ghostDataに読み込んだデータを書き込む
         if (micData == null)
         {
             micData = new GhostData();
         }
         JsonUtility.FromJsonOverwrite(readAllText, micData);
     }
     Debug.Log("ゴーストデータをロードしました。");
 }
Example #7
0
    Vector3 LerpMovement(GhostData data)
    {
        Node target = pathFinder.GetNodeInDirection(data.getCurrentNode(), data.getDirection());

        if (data.getLerpTime() > 1f)
        {
            data.setLerpTime(0f);
        }

        return(Vector3.Lerp(data.getCurrentNode().pos, target.pos, data.getLerpTime()));
    }
 public void Load()
 {
     if (File.Exists(Application.dataPath + saveDataFolder + saveFileName))
     {
         string readAllText = File.ReadAllText(Application.dataPath + saveDataFolder + saveFileName);
         // ghostDataに読み込んだデータを書き込む
         if (ghostData == null)
         {
             ghostData = new GhostData();
         }
         JsonUtility.FromJsonOverwrite(readAllText, ghostData);
         Debug.Log("ゴーストデータをロードしました。");
     }
 }
Example #9
0
    public void SubmitNewGhost(string name, Vector3 position, Quaternion rotation)
    {
        // Create the json
        GhostData data = new GhostData();

        data.position = position;
        data.rotation = rotation;

        string json = JsonUtility.ToJson(data);

        //Debug.Log(json);

        StartCoroutine(PostRequest("http://" + ghostServerHost + "/stages/" + stageID + "/ghosts?app=" + app + "&id=" + name, json));
    }
Example #10
0
    void HandleCollisions(GhostData ghost)
    {
        Node      myNode    = ghost.getCurrentNode();
        Direction myDir     = ghost.getDirection();
        Node      frontNode = pathFinder.GetNodeInDirection(myNode, myDir);

        foreach (GhostData otherGhost in ghostMap.Values)
        {
            if (otherGhost != ghost && !otherGhost.getRespawn() && (myNode == otherGhost.getCurrentNode() || frontNode == otherGhost.getCurrentNode()))
            {
                ghost.setDirection(FlipDirection(myDir));
                ghost.setLerpTime(0);
            }
        }
    }
Example #11
0
    /// <summary>
    /// Load ghost information from a SAV file.
    /// </summary>
    /// <param name="trackName"></param>
    /// <param name="speed"></param>
    /// <returns></returns>
    public static GhostData LoadGhost(string trackName, E_SPEEDCLASS speed)
    {
        // create new ghost data and load file
        GhostData ghost = new GhostData();
        SAVDAT data = ReadSav(E_SAVELOCATIONS.GHOSTS, trackName + "_" + speed);

        // get ship from first line
        if (data.exists)
        {
            ghost.ship = (E_SHIPS)System.Convert.ToInt32(data.lines[0]);

            // read positions and rotations
            List<Vector3> positions = new List<Vector3>();
            List<Quaternion> rotations = new List<Quaternion>();
            int i = 0;
            int alt = 0;
            for (i = 1; i < data.lines.Length; ++i)
            {
                // get current line and remove whitespace
                string line = data.lines[i];
                line.Trim();

                // split it
                char[] split = { ' ' };
                string[] lineArray = line.Split(split, 50);

                // load positions/rotations
                if (alt == 0)
                    positions.Add(new Vector3(System.Convert.ToInt32(lineArray[0]), System.Convert.ToInt32(lineArray[1]), System.Convert.ToInt32(lineArray[2])));
                else if (alt == 1)
                    rotations.Add(new Quaternion(float.Parse(lineArray[0]), float.Parse(lineArray[1]), float.Parse(lineArray[2]), float.Parse(lineArray[3])));

                // increase alternate
                alt++;
                if (alt > 1)
                    alt = 0;
            }

            // convert to ghost data arrays
            ghost.positions = positions.ToArray();
            ghost.rotations = rotations.ToArray();
        }

        ghost.dataFound = data.exists;

        return ghost;
    }
    // キャラクターデータの保存
    public void StartRecord()
    {
        // 保存する時はゴーストの再生を停止


        /*if (onlyone = true)//変更
         *      {
         *              Debug.Log("Restart from the beginning");
         *              return;
         *      }*/
        isRecord    = true;
        elapsedTime = 0f;
        ghostData   = new GhostData();
        //onlyone = true;

        Debug.Log("StartRecord");
    }
Example #13
0
        public override IEnumerator Regen(EntityPlayer player, Vector3i zchunk, int iniguess)
        {
            Bounds        bounds   = ZChunk.Bounds4(zchunk, iniguess);
            List <Entity> existing = GameManager.Instance.World.GetEntitiesInBounds(
                EntityGhost.Concretes[this.concreteIdx],
                bounds,
                new List <Entity>()
                );

            yield return(Iterating.Repeater.Frame); // listent may be costly

            Vector3i min = Vectors.ToInt(bounds.min);
            Vector3i max = Vectors.ToInt(bounds.max);

            int current = existing.Count;
            int gen     = ZChunk.Size(this.gen);
            // gen = 1; // DEBUG
            int regen = ZChunk.Size(this.regen);
            int iniy  = (int)Math.Floor(player.GetPosition().y);

            Zombiome.Routines.Start(Routines.IfNotRunning(
                                        LockRenew,
                                        EffectExisting(player, existing)
                                        ), "Ghost-Existing");

            int nnew = Math.Min(limit_new, gen - current);

            Entity[] Tracker = new Entity[] { null };
            if (current < regen)
            {
                Printer.Log(45, "Ghost regen", regen, current, gen, "=>", gen - current);
                for (int k = 0; k < nnew; k++)
                {
                    Vector3i pos = new Vector3i(rand.RandomRange(min.x, max.x), 0, rand.RandomRange(min.z, max.z));
                    pos = Geo3D.Surface(pos, iniy);
                    if (GameManager.Instance.World.GetTerrainHeight(pos.x, pos.z) > 2)
                    {
                        Printer.Log(40, "Ghost", pos, opt.OptionEntity.entity, opt.OptionEntity.buff);
                        Emplacement place = Emplacement.At(Vectors.ToFloat(pos) + 2f * Vectors.Float.UnitY, Vectors.Float.UnitY);
                        GhostData   gdata = (ghost_type == "") ? this.GhostData : GhostData.Ghosts[ghost_type];
                        yield return(EntityGhost.Create(gdata, place, opt.OptionEntity.entity));
                    }
                    yield return(Repeater.Yield);
                }
            }
        }
    public static void SetNextPosition(Vector3 pos, Quaternion rot)
    {
        int i = instance.currentWriteIndex;

        if (i > instance.datasize)
        {
            Debug.LogError("data overflow");
            return;
        }

        GhostData d = new GhostData();

        d.Init(pos, rot);
        instance.writeData[i] = d;

        instance.currentWriteIndex++;
    }
Example #15
0
        // Start is called before the first frame update
        void Start()
        {
            Ghost = new GhostData();


            if (SceneManager.GetActiveScene().buildIndex == 3)
            {
                Handler = GameObject.FindObjectOfType <ControllerHandler>();

                GameState = new GameStateData();

                GameState.FirstPlaceID   = 0;
                GameState.SecondPlaceID  = 0;
                GameState.ThirdPlaceID   = 0;
                GameState.FourthPlaceID  = 0;
                GameState.FirstRaceTime  = 0;
                GameState.SecondRaceTime = 0;
                GameState.ThirdRaceTime  = 0;
                GameState.FourthRaceTime = 0;
                GameState.numPlayer      = Handler.assignedControllerCount;


                GhostCar = GameObject.FindGameObjectWithTag("Ghost");
                LoadGhost();

                gameManager = GameObject.FindObjectOfType <GameManager>();

                if (GhostLoaded)
                {
                    GameState.oldGhostTime = Ghost.ghostTime;
                }
            }



            if (SceneManager.GetActiveScene().buildIndex == 4)
            {
                LoadRaceData("GameData.xml");
                Debug.Log("Player 1 played " + GameState.P1Character.ToString());
            }
        }
Example #16
0
    void LoadGhostData()
    {
        TextAsset   textAsset = (TextAsset)Resources.Load("Xml/" + fileName);
        XmlDocument xmlDoc    = new XmlDocument();

        xmlDoc.LoadXml(textAsset.text);

        XmlNodeList nodes = xmlDoc.SelectNodes("GhostSet/Ghost");

        ghostData = new List <GhostData>();

        foreach (XmlNode node in nodes)
        {
            GhostData ghost = new GhostData();
            ghost._level       = System.Int32.Parse(node.SelectSingleNode("Level").InnerText);
            ghost._name        = node.SelectSingleNode("Name").InnerText;
            ghost._earnMoney   = System.Int32.Parse(node.SelectSingleNode("EarnMoney").InnerText);
            ghost._description = node.SelectSingleNode("Description").InnerText;
            ghost._isActive    = false;
            ghostData.Add(ghost);
        }
    }
Example #17
0
    private void InitProperty(GhostData data)
    {
        LevelTableItem levelRes = DataManager.LevelTable[data.level] as LevelTableItem;

        if (levelRes == null)
        {
            GameDebug.LogError("level.txt 配置错误");
            return;
        }

        SetBaseProperty((int)PropertyTypeEnum.PropertyTypeHP, levelRes.maxhp);
        SetBaseProperty((int)PropertyTypeEnum.PropertyTypeMaxHP, levelRes.maxhp);
        SetBaseProperty((int)PropertyTypeEnum.PropertyTypeMana, levelRes.energy);
        SetBaseProperty((int)PropertyTypeEnum.PropertyTypeMaxMana, levelRes.energy);
        SetBaseProperty((int)PropertyTypeEnum.PropertyTypeDamage, levelRes.damage);
        SetBaseProperty((int)PropertyTypeEnum.PropertyTypeCrticalLV, levelRes.crticalLV);
        SetBaseProperty((int)PropertyTypeEnum.PropertyTypeDefance, levelRes.damageReduce);
        SetBaseProperty((int)PropertyTypeEnum.PropertyTypeSpeed, mRes.speed);

//      mHpRegRate = levelRes.hpRegRate;
//      mManaRegRate = levelRes.manaRegRate;
    }
Example #18
0
    public static IEnumerator Create(GhostData data, Emplacement place, string entityCls)
    {
        /** Create a Ghost with buffs, death-fragment (string cvar) and slowfall */
        // all ghost are lost at +100 and 3s
        if (data.drop > 0)
        {
            place.position.y = place.position.y + 40;
        }
        Entity[] Tracker   = new Entity[] { null };
        Entity   Requested = EntityCreation.Spawn(place.position, entityCls);

        yield return(EntityCreation.WaitEntity(Requested, 1.5f, Tracker));

        EntityAlive created = Tracker[0] as EntityAlive;

        if (created == null)
        {
            // Printer.Print("EntityGhost. Null:", Tracker[0]);
            yield break;
        }
        // Printer.Print("EntityGhost.Create:", created);
        if (data.deadFragment != "")
        {
            // created.SetCVar("ZBvalue_buffZBexplosif", StringMap.Encode(data.deadFragment));
            created.SetCVar(MinEventActionExplodeEntity.cvarKey, StringMap.Encode(data.deadFragment));
            //Printer.Print("EntityGhost.Create:", "ZBvalue_buffZBexplosif", StringMap.Encode(data.deadFragment));
        }
        foreach (string buff in data.buffs)
        {
            created.Buffs.AddBuff(buff);
            //Printer.Print("EntityGhost.Create:", buff, created);
        }
        if (data.drop > 0)
        {
            //Printer.Print("EntityGhost.SlowFall:", data.drop, created);
            EntityMover.SlowFall.Start(Tracker[0], data.drop, 0);
        }
    }
Example #19
0
        public void LoadGhost()
        {
            if (File.Exists("Ghost Data.xml"))
            {
                XmlSerializer Serializer = new XmlSerializer(typeof(GhostData));
                FileStream    Stream     = new FileStream("Ghost Data.xml", FileMode.Open);
                Ghost = Serializer.Deserialize(Stream) as GhostData;
                Stream.Close();


                GhostFrameMax       = Ghost.ghostPostions.Count;
                newGhostPostions    = Ghost.ghostPostions;
                Ghost.ghostPostions = new List <Vector3>();
                GhostLoaded         = true;

                Debug.Log("Ghost Loaded");
            }
            else
            {
                Debug.Log("No Ghost");
                Ghost.ghostPostions = new List <Vector3>();
            }
        }
Example #20
0
    void DisplayGhostInfo(GhostData data)
    {
        ghostInfoPannel.SetActive(true);

        StringBuilder sb = new StringBuilder();

        sb.AppendFormat("{0}. {1}", data._level, data._name);
        ghostInfoPannel.transform.FindChild("Name").GetComponent <Text>().text = sb.ToString();

        ghostInfoPannel.transform.FindChild("Description").GetComponent <Text>().text = data._description;

        sb.Remove(0, sb.Length);
        sb.AppendFormat("Income : {0}", data._earnMoney);
        ghostInfoPannel.transform.FindChild("Income").GetComponent <Text>().text = sb.ToString();

        ghostInfoPannel.transform.FindChild("Ghost").GetComponent <Image>().overrideSprite = Resources.LoadAll <Sprite>("cats2")[data._level - 1];

        GameObject effect = Instantiate(newGhostEffect) as GameObject;

        effect.transform.position = new Vector3(0.0f, 1.1f, 0.0f);
        effect.GetComponent <Renderer>().sortingLayerName = "Particle";

        tmpEffect = effect;
    }
Example #21
0
    /// <summary>
    /// Sava ghost information to a SAV file.
    /// </summary>
    /// <param name="trackName"></param>
    /// <param name="speed"></param>
    /// <param name="data"></param>
    public static void SaveGhost(string trackName, E_SPEEDCLASS speed,  GhostData data)
    {
        List<string> positions = new List<string>();
        List<string> rotations = new List<string>();
        List<string> lines = new List<string>();

        // populate data to write
        int i = 0;
        for (i = 0; i < data.positions.Length; ++i)
            positions.Add(string.Format("{0} {1} {2}", data.positions[i].x, data.positions[i].y, data.positions[i].z));

        for (i = 0; i < data.rotations.Length; ++i)
            rotations.Add(string.Format("{0} {1} {2} {4}", data.rotations[i].x, data.rotations[i].y, data.rotations[i].z, data.rotations[i].w));

        // pack into single string array
        lines.Add(((int)data.ship).ToString());
        for (i = 0; i < positions.Count; ++i)
            lines.Add(positions[i]);
        for (i = 0; i < rotations.Count;  ++i)
            lines.Add(rotations[i]);

        // create new save data and write
        SAVDAT sav = new SAVDAT();
        sav.lines = lines.ToArray();
        sav.saveLocation = E_SAVELOCATIONS.GHOSTS;

        WriteSav(sav, trackName + "_" + speed);
    }
Example #22
0
 public void ManageParticle(EntityPlayer player, GhostData ghost)
 {
     this.GhostData = ghost;
     Zombiome.Routines.Start(Routines.IfNotRunning(lockRunExternal, _Next(player)), "Ghost-Particle");
 }
 private static string GetPostAuthor(GhostData ghostData, GhostPost post)
 {
     return(ghostData.data.users.FirstOrDefault(u => u.id == post.created_by).name);
 }
Example #24
0
    int index;                                  //Index of current record frame

    private void Start()
    {
        rb2d = GetComponent <Rigidbody2D>();
        gd   = GetComponent <GhostData>();
        ac   = GetComponent <GhostAnimationController>();
    }
        private static IEnumerable <string> GetPostCategories(GhostData ghostData, GhostPost post)
        {
            var postCategoryIds = ghostData.data.posts_tags.Where(t => t.post_id == post.id).Select(c => c.tag_id).ToList();

            return(postCategoryIds.Select(id => ghostData.data.tags.FirstOrDefault(t => t.id == id).name).ToArray());
        }