Esempio n. 1
0
        public GameObject getUFO(int round)
        {
            GameObject need;

            if (isFree.Count <= 0)
            {
                need = UnityEngine.Object.Instantiate(Resources.Load <GameObject>("Prefabs/UFO"), ruler.getStart(), Quaternion.identity) as GameObject;
                need.AddComponent <UFO>();
                Rigidbody rigidbody = need.AddComponent <Rigidbody>();
                rigidbody.useGravity = false;
            }
            else
            {
                need = isFree[0];
                isFree.Remove(need);
            }
            isInuse.Add(need);

            int      index    = ruler.getColor();
            Material material = UnityEngine.Object.Instantiate(Resources.Load <Material>("Materials/" + Enum.GetName(typeof(Ruler.Color), index)));

            need.GetComponent <MeshRenderer>().material = material;

            UFO ufo = need.GetComponent <UFO>();

            ufo.setScale(ruler.getScale(Judge.getInstance().getRound()));
            need.transform.position = ruler.getStart();
            ufo.setDespos(ruler.getDes(need.transform.position));
            ufo.setScore(index + 1);

            return(need);
        }
Esempio n. 2
0
        public void FlyUFO(List <GameObject> waitToFly, Ruler ruler, int round)
        {
            List <SSAction> toMove = new List <SSAction>();

            for (int i = 0; i < waitToFly.Count; i++)
            {
                toMove.Add(CCMoveToAction.GetSSAction(waitToFly[i], ruler.getDes(waitToFly[i].transform.position), ruler.getSpeed(round) * AnimateSpeed, null));
            }
            sequenceAction action = sequenceAction.GetSSAction(1, 0, toMove, this);

            addAction(action);
        }
Esempio n. 3
0
        public void FlyUFO(List <GameObject> waitToFly, Ruler ruler, int round)
        {
            SSAction action;
            float    waitTime = 0;

            for (int i = 0; i < waitToFly.Count; i++)
            {
                Debug.Log("Flying");
                action = CCMoveToAction.GetSSAction(waitToFly[i], ruler.getDes(waitToFly[i].transform.position), ruler.getSpeed(round) * AnimateSpeed, this);
                if (i == 0)
                {
                    addAction(action);
                }
                else
                {
                    addWaitAction(action);
                    StartCoroutine(setNextFly(waitTime, action));
                }
                waitTime += ruler.getIntervals(round);
            }
        }
Esempio n. 4
0
        public void FlyUFO(GameObject gameObject, Ruler ruler, int round)
        {
            CCMoveToAction action = CCMoveToAction.GetSSAction(gameObject, ruler.getDes(gameObject.transform.position), ruler.getSpeed(round) * AnimateSpeed, this);

            addAction(action);
        }