Example #1
0
 public void PlayDisk()
 {
     if (disks.used.Count > 0)
     {
         GameObject     disk         = disks.used[0];
         float          x            = Random.Range(-10, 10);
         CCMoveToAction moveToAction = CCMoveToAction.GetSSAction(new Vector3(x, 12, 0), 3 * (Mathf.CeilToInt(FirstSceneController.times / 10) + 1) * Time.deltaTime);
         seq.Add(moveToAction);
         this.RunAction(disk, moveToAction, this);
         disks.used.RemoveAt(0);
     }
     if (Input.GetMouseButtonDown(0) && sceneController.flag == 0)
     {
         Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
         RaycastHit hitGameObject;
         if (Physics.Raycast(ray, out hitGameObject))
         {
             GameObject gameObject = hitGameObject.collider.gameObject;
             if (gameObject.tag == "disk")
             {
                 foreach (var k in seq)
                 {
                     if (k.gameObject == gameObject)
                     {
                         k.transform.position = k.target;
                     }
                 }
                 userClickAction = UserClickAction.GetSSAction();
                 this.RunAction(gameObject, userClickAction, this);
             }
         }
     }
     base.Update();
 }
Example #2
0
 public void PlaySkeet()
 {
     if (skeets.used.Count > 0)
     {
         GameObject skeet = skeets.used[0];
         float      x     = Random.Range(-5, 5);
         skeet.transform.GetComponent <Rigidbody>().isKinematic = false;
         skeet.GetComponent <Rigidbody>().velocity = new Vector3(x, 8 * (Mathf.CeilToInt(FirstSceneController.times / 10) + 1) + 2, 6);
         skeet.GetComponent <Rigidbody>().AddForce(new Vector3(0, 8.8f, 0), ForceMode.Force);
         PhysicAction physicAction = PhysicAction.GetSSAction();
         seq.Add(physicAction);
         this.RunAction(skeet, physicAction, this);
         skeets.used.RemoveAt(0);
     }
     if (Input.GetMouseButtonDown(0) && sceneController.flag == 0)
     {
         Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
         RaycastHit hitGameObject;
         if (Physics.Raycast(ray, out hitGameObject))
         {
             GameObject gameObject = hitGameObject.collider.gameObject;
             if (gameObject.tag == "skeet")
             {
                 gameObject.transform.position = new Vector3(100, 100, 100);
                 userClickAction = UserClickAction.GetSSAction();
                 this.RunAction(gameObject, userClickAction, this);
             }
         }
     }
     base.Update();
 }
Example #3
0
    public static UserClickAction GetSSAction(int s)
    {
        UserClickAction action = CreateInstance <UserClickAction>();

        action.add_score = s;
        return(action);
    }
Example #4
0
    protected new void Update()
    {
        if (factory.used_ufos.Count > 0)
        {
            GameObject     disk         = factory.used_ufos[0].gameObject;
            float          x            = Random.Range(-10, 10);
            CCMoveToAction moveToAction = CCMoveToAction.GetSSAction(new Vector3(x, 12, 0), (Mathf.CeilToInt(FirstSceneController.times / 10) + 1) * Time.deltaTime);
            if (disk.transform.GetComponent <Renderer>().material.color == Color.red)
            {
                moveToAction = CCMoveToAction.GetSSAction(new Vector3(x, 12, 0), 5 * (Mathf.CeilToInt(FirstSceneController.times / 10) + 1) * Time.deltaTime);
            }
            else if (disk.transform.GetComponent <Renderer>().material.color == Color.green)
            {
                moveToAction = CCMoveToAction.GetSSAction(new Vector3(x, 12, 0), 4 * (Mathf.CeilToInt(FirstSceneController.times / 10) + 1) * Time.deltaTime);
            }
            else if (disk.transform.GetComponent <Renderer>().material.color == Color.blue)
            {
                moveToAction = CCMoveToAction.GetSSAction(new Vector3(x, 12, 0), 3 * (Mathf.CeilToInt(FirstSceneController.times / 10) + 1) * Time.deltaTime);
            }

            seq.Add(moveToAction);
            this.RunAction(disk, moveToAction, this);
            factory.used_ufos.RemoveAt(0);
        }
        if (Input.GetMouseButtonDown(0) && sceneController.flag == 0)
        {
            Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            RaycastHit hitGameObject;
            if (Physics.Raycast(ray, out hitGameObject))
            {
                GameObject gameObject = hitGameObject.collider.gameObject;
                if (gameObject.tag == "ufo")
                {
                    foreach (var k in seq)
                    {
                        if (k.gameObject == gameObject)
                        {
                            k.transform.position = k.target;
                        }
                    }
                    if (gameObject.transform.GetComponent <Renderer>().material.color == Color.red)
                    {
                        userClickAction = UserClickAction.GetSSAction(3);
                    }
                    else if (gameObject.transform.GetComponent <Renderer>().material.color == Color.green)
                    {
                        userClickAction = UserClickAction.GetSSAction(2);
                    }
                    else if (gameObject.transform.GetComponent <Renderer>().material.color == Color.blue)
                    {
                        userClickAction = UserClickAction.GetSSAction(1);
                    }
                    this.RunAction(gameObject, userClickAction, this);
                }
            }
        }
        base.Update();
    }
 public void Play()
 {
     if (factory.used_ufos.Count > 0)
     {
         GameObject disk = factory.used_ufos[0];
         float      x    = Random.Range(-5, 5);
         disk.GetComponent <Rigidbody>().isKinematic = false;
         disk.GetComponent <Rigidbody>().velocity    = new Vector3(x, 8 * (Mathf.CeilToInt(FirstSceneController.times / 10) + 1), 6);
         disk.GetComponent <Rigidbody>().AddForce(new Vector3(0, 8.8f, 0), ForceMode.Force);
         PhysicsEmitAction physicsEmitAction = PhysicsEmitAction.GetSSAction();
         seq.Add(physicsEmitAction);
         this.RunAction(disk, physicsEmitAction, this);
         factory.used_ufos.RemoveAt(0);
     }
     if (Input.GetMouseButtonDown(0) && sceneController.flag == 0)
     {
         Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
         RaycastHit hitGameObject;
         if (Physics.Raycast(ray, out hitGameObject))
         {
             GameObject gameObject = hitGameObject.collider.gameObject;
             Debug.Log(gameObject.tag);
             if (gameObject.tag == "ufo")
             {
                 gameObject.transform.position = new Vector3(0, 1, -10);
                 if (gameObject.transform.GetComponent <Renderer>().material.color == Color.red)
                 {
                     userClickAction = UserClickAction.GetSSAction(3);
                 }
                 else if (gameObject.transform.GetComponent <Renderer>().material.color == Color.green)
                 {
                     userClickAction = UserClickAction.GetSSAction(2);
                 }
                 else if (gameObject.transform.GetComponent <Renderer>().material.color == Color.blue)
                 {
                     userClickAction = UserClickAction.GetSSAction(1);
                 }
                 this.RunAction(gameObject, userClickAction, this);
             }
         }
     }
     base.Update();
 }
Example #6
0
 public void OnBoat(GameObject gameObject, ISSActionCallback callback)
 {
     userClickAction = UserClickAction.GetSSAction();
     this.RunAction(gameObject, userClickAction, callback);
 }
Example #7
0
    // Use this for initialization

    public static UserClickAction GetSSAction()
    {
        UserClickAction action = CreateInstance <UserClickAction>();

        return(action);
    }