Ejemplo n.º 1
0
    private void sendOneDisk(int sendLever)
    {
        numOfDiskAlredySend++;
        diskInfo oneDisk    = diskFac.getDisk(sendLever, ifPhysicManager);
        diskMove moveAction = diskMove.getDiskMove(oneDisk, sendLever, ifPhysicManager);

        actionManager.RunAction(oneDisk.disk, moveAction, null);
    }
Ejemplo n.º 2
0
    public static diskMove getDiskMove(diskInfo disk, int lever, bool ifPhysicManager)
    {
        diskMove action = ScriptableObject.CreateInstance <diskMove> ();

        action.thisDisk = disk;
        switch (lever)
        {
        case 1:
            action.speed = 6f;
            break;

        case 2:
            action.speed = 8f;
            break;

        case 3:
            action.speed = 10f;
            break;
        }

        if (!ifPhysicManager)
        {
            action.aim = new Vector3(Random.Range(-2f, 2f), Random.Range(-2f, 2f), Random.Range(4f, 10f));
        }
        else
        {
            action.aim = Vector3.zero;
            float xPositionOfMax, xPositionOfMin, yPositionOfMax, yPositionOfMin;
            if (disk.disk.transform.position.x > 0)
            {
                xPositionOfMax = 0.2f;
                xPositionOfMin = 0f;
            }
            else
            {
                xPositionOfMax = 0f;
                xPositionOfMin = -0.2f;
            }

            if (disk.disk.transform.position.y > 0)
            {
                yPositionOfMax = 0.2f;
                yPositionOfMin = 0f;
            }
            else
            {
                yPositionOfMax = 0f;
                yPositionOfMin = -0.2f;
            }
            action.dirction = new Vector3(Random.Range(xPositionOfMin, xPositionOfMax)
                                          , Random.Range(yPositionOfMin, yPositionOfMax), Random.Range(0.2f, 1f));
            Rigidbody rigid = action.thisDisk.disk.GetComponent <Rigidbody> ();
            rigid.AddForce(action.dirction * action.speed, ForceMode.VelocityChange);
            rigid.useGravity = false;
        }
        return(action);
    }
Ejemplo n.º 3
0
    public static diskMove getDiskMove(diskInfo disk, int lever)
    {
        diskMove action = ScriptableObject.CreateInstance <diskMove> ();

        switch (lever)
        {
        case 1:
            action.speed = 6f;
            break;

        case 2:
            action.speed = 8f;
            break;

        case 3:
            action.speed = 10f;
            break;
        }
        action.thisDisk = disk;
        action.aim      = new Vector3(Random.Range(-2f, 2f), Random.Range(-2f, 2f), Random.Range(4f, 10f));
        return(action);
    }