コード例 #1
0
        public override void CallEvent()
        {
            if (DataManipulators.DataPool.Instance == null)
            {
                return;
            }

            Vector3 pos;

            pos.z = -1f;

            float angle;

            for (int i = 0; i < NumOfBalls; ++i)
            {
                angle = 360f * i / (NumOfBalls);

                pos.x = -aLength *Mathf.Sin(Mathf.Deg2Rad *angle);

                pos.y = aLength
                        * Mathf.Cos(Mathf.Deg2Rad * angle);


                GameObject localObj = DataManipulators.DataPool.Instance.GetInactiveObject(DataManipulators.DataPool.E_ObjectType.SideBall);

                if (localObj == null)
                {
                    return;
                }

                Ball localComp = localObj.GetComponent <Ball>();

                if (localComp)
                {
                    SideBall testComp = localComp as SideBall;

                    if (testComp != null)
                    {
                        testComp.LiveTime = 2 * aLength / testComp.Speed;
                    }

                    localComp.BallSpawn(pos, Quaternion.Euler(0, 0, angle + 180f));
                }
            }

            HUD_Element.gameObject.SetActive(true);
        }
コード例 #2
0
ファイル: GameEvent_Slide.cs プロジェクト: luedos/JumpReflect
        public override void CallEvent()
        {
            if (DataManipulators.DataPool.Instance == null)
            {
                return;
            }

            Vector3 pos;

            pos.z = -1f;

            int s = 1, sa = 1;
            int dir = Random.Range(0, 4);


            if (dir > 1)
            {
                sa = -1;
            }
            if (dir == 1 || dir == 2)
            {
                s = -1;
            }

            float angle = 180 + dir * 90f;

            for (int i = 0; i < NumOfBalls; ++i)
            {
                if (dir == 0 || dir == 2)
                {
                    pos.x = s * (NumOfBalls - 1 - 2 * i) * bLength / (2 * NumOfBalls);
                    pos.y = s * aLength + sa * (NumOfBalls - 1 - 2 * i) * cLength / (2 * NumOfBalls);
                }
                else
                {
                    pos.x = s * aLength + sa * (NumOfBalls - 1 - 2 * i) * cLength / (2 * NumOfBalls);
                    pos.y = s * (NumOfBalls - 1 - 2 * i) * bLength / (2 * NumOfBalls);
                }


                GameObject localObj = DataManipulators.DataPool.Instance.GetInactiveObject(DataManipulators.DataPool.E_ObjectType.SideBall);

                if (localObj == null)
                {
                    return;
                }

                Ball localComp = localObj.GetComponent <Ball>();

                if (localComp)
                {
                    SideBall testComp = localComp as SideBall;

                    if (testComp != null)
                    {
                        testComp.LiveTime = 2 * aLength / testComp.Speed;
                    }

                    localComp.BallSpawn(pos, Quaternion.Euler(0, 0, angle));
                }
            }

            switch (dir)
            {
            case 0:
                HUD_Top.gameObject.SetActive(true);
                break;

            case 1:
                HUD_Left.gameObject.SetActive(true);
                break;

            case 2:
                HUD_Bottom.gameObject.SetActive(true);
                break;

            case 3:
                HUD_Right.gameObject.SetActive(true);
                break;
            }
        }
コード例 #3
0
ファイル: GameEvent_Line.cs プロジェクト: luedos/JumpReflect
        public override void CallEvent()
        {
            if (DataManipulators.DataPool.Instance == null)
            {
                return;
            }

            Vector3 pos;

            pos.z = -1f;

            int hs = 1;
            int ws = 1;

            float angle = 119.36f;

            int dir = Random.Range(0, 4);

            if (dir > 1)
            {
                angle += 180f;
                hs     = -1;
            }
            if (dir == 1 || dir == 2)
            {
                ws = -1;
            }

            if (hs != ws)
            {
                angle += 121.28f;
            }

            for (int i = 0; i < NumOfBalls; ++i)
            {
                pos.x = ws * (0.871576f * aLength - 0.49026f * bLength * (NumOfBalls - 1 - 2 * i) / (2 * NumOfBalls));
                pos.y = hs * (0.49026f * aLength + 0.871576f * bLength * (NumOfBalls - 1 - 2 * i) / (2 * NumOfBalls));


                GameObject localObj = DataManipulators.DataPool.Instance.GetInactiveObject(DataManipulators.DataPool.E_ObjectType.SideBall);

                if (localObj == null)
                {
                    return;
                }

                Ball localComp = localObj.GetComponent <Ball>();

                if (localComp)
                {
                    SideBall testComp = localComp as SideBall;

                    if (testComp != null)
                    {
                        testComp.LiveTime = 2 * aLength / testComp.Speed;
                    }

                    localComp.BallSpawn(pos, Quaternion.Euler(0, 0, angle));
                }
            }

            switch (dir)
            {
            case 0:
                HUD_TopRight.gameObject.SetActive(true);
                break;

            case 1:
                HUD_TopLeft.gameObject.SetActive(true);
                break;

            case 2:
                HUD_BottomLeft.gameObject.SetActive(true);
                break;

            case 3:
                HUD_BottomRight.gameObject.SetActive(true);
                break;
            }
        }