Exemplo n.º 1
0
    void OnAvatarShoot(int value)
    {
        InputSaverData isd = new InputSaverData();

        isd.shoot = true;
        AddToRecordingList(isd);
    }
Exemplo n.º 2
0
    void OnAvatarJump(int id)
    {
        InputSaverData isd = new InputSaverData();

        isd.jump = true;
        AddToRecordingList(isd);
    }
Exemplo n.º 3
0
    //InputSaverData lastSavedDataUsed;
    //void Update () {

    //	if (Data.Instance.playMode == Data.PlayModes.PARTYMODE)
    //		return;
    //	if (allPlayersSavedData.Count == 0 || !isPlaying || characters.Count==0)
    //		return;

    //	foreach(CharacterBehavior cb in characters)
    //	{
    //		if (cb.state == CharacterBehavior.states.DEAD ||
    //		    cb.state == CharacterBehavior.states.FALL ||
    //		    cb.state == CharacterBehavior.states.CRASH)
    //		{
    //			//is dead;
    //		} else if(cb.player != null){
    //			UpdatePlayer (cb);
    //		}
    //	}
    //}
    void UpdatePlayer(CharacterBehavior cb)
    {
        int       playerID  = cb.player.id;
        SavedData savedData = allPlayersSavedData [playerID - 1];

        if (savedData.lastIdDataUsed >= savedData.data.Count)
        {
            return;
        }

        InputSaverData isdata = savedData.data [savedData.lastIdDataUsed];

        InputSaverData nextdata = null;

        if (savedData.data.Count > savedData.lastIdDataUsed + 1)
        {
            nextdata = savedData.data [savedData.lastIdDataUsed + 1];
        }

        if (charactersManager.distance >= isdata.distance)
        {
            savedData.lastIdDataUsed++;
            if (isdata.shoot)
            {
                //shoot
                cb.shooter.CheckFire();
            }
            else if (isdata.jump)
            {
                //jump
                cb.Jump();
            }
            else
            {
                //move
                //savedData.lastDirection = isdata.direction;
//				Vector3 pos = cb.transform.position;
//				pos.x = isdata.posX;
//				cb.transform.position = pos;
            }
            //savedData.data.RemoveAt (0);
        }
        if (nextdata != null)
        {
            float moveX = 0.5f;
            if (isdata.posX > nextdata.posX)
            {
                moveX *= -1;
            }
            if (isdata.posX < nextdata.posX)
            {
                moveX *= 1;
            }
            else
            {
                return;
            }
            cb.controls.MoveInX(moveX);
        }
    }
    public void MoveInX(float value, Vector3 pos)
    {
        InputSaverData isd = new InputSaverData();

        isd.direction = value;
        isd.posX      = pos.x;
        AddToRecordingList(isd);
    }
Exemplo n.º 5
0
    public void MoveInX(float posX)
    {
        InputSaverData isd = new InputSaverData();

        //isd.direction = value;

        //print("GRABA pos.x: " + posX);
        isd.posX = posX;
        AddToRecordingList(isd);
    }
    public void SaveNewList(List <InputSaverData> newList)
    {
        if (allPlayersSavedData.Count > 2)
        {
            allPlayersSavedData.RemoveAt(0);
        }
        //allPlayersSavedData.Clear ();

        SavedData newSavedData = new SavedData();

        newSavedData.data = new List <InputSaverData> ();

        foreach (InputSaverData data in newList)
        {
            InputSaverData newData = data;
            newSavedData.data.Add(newData);
        }

        allPlayersSavedData.Add(newSavedData);
    }
    void UpdatePlayer(CharacterBehavior cb)
    {
        int       playerID  = cb.player.id;
        SavedData savedData = allPlayersSavedData [playerID - 1];

        if (savedData.lastIdDataUsed >= savedData.data.Count)
        {
            return;
        }

        InputSaverData isdata = savedData.data [savedData.lastIdDataUsed];

        if (charactersManager.distance >= isdata.distance)
        {
            savedData.lastIdDataUsed++;
            if (isdata.shoot)
            {
                //shoot
                cb.shooter.CheckFire();
            }
            else if (isdata.jump)
            {
                //jump
                cb.Jump();
            }
            else
            {
                //move
                savedData.lastDirection = isdata.direction;
                Vector3 pos = cb.transform.position;
                pos.x = isdata.posX;
                cb.transform.position = pos;
            }
            //savedData.data.RemoveAt (0);
        }
        cb.controls.MoveInX(savedData.lastDirection);
    }
Exemplo n.º 8
0
 void AddToRecordingList(InputSaverData isd)
 {
     isd.distance = Game.Instance.level.charactersManager.distance;
     recordingList.Add(isd);
 }