Exemplo n.º 1
0
    private void PerformeMovment(SavedMove savedMove, float deltaTime)
    {
        if (savedMove.stand)
        {
            BotState = BotState.Standing;
            animat.SetInteger("condition", 0);
        }
        else
        {
            BotState = BotState.Moving;
            animat.SetInteger("condition", 1);
        }

        Vector3 MoveDirection = savedMove.getDirection();

        Move(MoveDirection, deltaTime);

        transform.rotation = Quaternion.Euler(savedMove.getRotationAngle());

        if (savedMove.shooting)
        {
            Shooting();
        }
    }
Exemplo n.º 2
0
    void RemoveSimilarPackets() //we merge same inputs into one
    {
        SavedMove toSendMove = new SavedMove();
        int       counter    = 0;

        foreach (SavedMove sm in PendingMoveList)
        {
            if (counter == 0)
            {
                toSendMove = sm;
                counter++; //first just scouts for first msg
            }
            else
            {
                if (Vector3.Distance(toSendMove.getPostion(), sm.getPostion()) < 0.05 && toSendMove.getDirection() == sm.getDirection() && !sm.shooting)
                {
                    Debug.Log("SAME PACKET TO REMOVE");
                    counter++;        //now counts amount of mssg to remove
                    toSendMove = sm;
                }
                else
                {
                    break; //next is diffrent so we will send first one anywat
                }
            }
        }

        Debug.Log(" PACKET TO REMOVE : " + (counter - 1));
        if (counter > 1)
        {
            PendingMoveList.RemoveRange(0, counter - 1);
        }
    }