Example #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);
    }
Example #2
0
 public void freeDisk(diskInfo diskinfo)
 {
     if (used.Contains(diskinfo))
     {
         diskinfo.disk.SetActive(false);
         used.Remove(diskinfo);
         free.Add(diskinfo);
     }
 }
Example #3
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);
    }
Example #4
0
 public void freeDisk(diskInfo diskinfo)      //将被击中的可用的disk添加到空闲链表中
 {
     if (pastdisk.Contains(diskinfo))
     {
         diskinfo.disk.SetActive(false);
         pastdisk.Remove(diskinfo);
         free.Add(diskinfo);
     }
 }
Example #5
0
    public void hitDisk(GameObject disk)
    {
        diskInfo temp = diskFac.getHitDisk(disk);

        if (temp == null)
        {
            Debug.Log("the disk of clicked is null? ");
        }
        else
        {
            scoreCtrl.addScore(temp.le);
            diskFac.freeDisk(temp);
        }
    }
Example #6
0
    public diskInfo getDisk(int le, bool ifPhysicManager)
    {
        diskInfo Cu_disk = null;         //当前飞碟链表信息

        if (free.Count > 0)
        {
            Cu_disk = free [0];
            Cu_disk.reset(le);
            pastdisk.Add(free [0]);
            free.Remove(free [0]);
        }
        else
        {
            DNum++;
            Cu_disk = new diskInfo(DNum, le, ifPhysicManager);
            pastdisk.Add(Cu_disk);
        }
        return(Cu_disk);
    }
Example #7
0
    public diskInfo getDisk(int lever, bool ifPhysicManager)
    {
        diskInfo nowDisk = null;

        if (free.Count > 0)
        {
            nowDisk = free [0];
            nowDisk.reset(lever);
            used.Add(free [0]);
            free.Remove(free [0]);
        }
        else
        {
            allDiskNum++;
            nowDisk = new diskInfo(allDiskNum, lever, ifPhysicManager);
            used.Add(nowDisk);
        }

        return(nowDisk);
    }
Example #8
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);
    }