コード例 #1
0
ファイル: BetModeContent.cs プロジェクト: cjh880118/GateBall
 void InitPlayerBall()
 {
     Red_Ball.AddComponent <BetModeBall_Controller>();
     White_Ball.AddComponent <BetModeBall_Controller>();
     ballScale             = Vector3.one * sm.BallScale;
     red_Ball_Controller   = Red_Ball.GetComponent <BetModeBall_Controller>();
     white_Ball_Controller = White_Ball.GetComponent <BetModeBall_Controller>();;
     red_Ball_Controller.Init(Gate1.transform.position);
     white_Ball_Controller.Init(Gate1.transform.position);
     Red_Ball.SetActive(false);
     red_Ball_Controller.isPlayerBall = true;
     White_Ball.SetActive(false);
 }
コード例 #2
0
ファイル: BetModeContent.cs プロジェクト: cjh880118/GateBall
        protected override void MissionSetting(SetMissionObjectMsg msg)
        {
            int level = igm.BetLevel;

            if (level > bm.MaxLV)
            {
                level = bm.MaxLV;
            }

            int distance = 0;
            int position = 0;
            int scale    = 0;

            int startNum = UnityEngine.Random.Range(0, 4);

            //카메라 배치
            inGameCamera.SetPosition(bm.GetStartPosition((BetStartPosition)startNum),
                                     bm.GetTargetPosition((BetStartPosition)startNum),
                                     Vector3.zero);

            GameObject Target = null;

            distance = UnityEngine.Random.Range(0, level);
            if (distance > bm.PlusZCount)
            {
                distance = bm.PlusZCount;
            }
            level -= distance;

            position = UnityEngine.Random.Range(0, level);
            if (position > bm.PlusXCount)
            {
                position = bm.PlusXCount;
            }
            level -= position;


            scale = UnityEngine.Random.Range(0, level);
            if (scale > bm.ScaleCount)
            {
                scale = bm.ScaleCount;
            }
            level -= scale;

            int mission;

            if (level >= bm.PoleLV)
            {
                mission = UnityEngine.Random.Range(0, 3);
            }
            else if (level >= bm.PoleLV && level < bm.TouchLV)
            {
                mission = UnityEngine.Random.Range(0, 2);
            }
            else
            {
                mission = 0;
            }

            Gate1.transform.localScale      = gateScale;
            White_Ball.transform.localScale = ballScale;
            Red_Ball.transform.localScale   = ballScale;
            Pole.transform.localScale       = poleScale;

            Gate1.SetActive(false);
            White_Ball.SetActive(false);
            Red_Ball.SetActive(false);
            Pole.SetActive(false);

            if (mission == 0)
            {
                level             -= bm.GateLV;
                Target             = Gate1;
                igm.BetModeMission = BetModeGame.Gate_1;

                if (startNum == 1 || startNum == 3)
                {
                    Gate1.transform.localEulerAngles = new Vector3(0, 90, 0);
                }
                else
                {
                    Gate1.transform.localEulerAngles = new Vector3(0, 0, 0);
                }
            }
            else if (mission == 1)
            {
                level -= bm.TouchLV;
                igm.BetModeMission = BetModeGame.Touch;

                if (igm.PlayerNum % 2 == 0)
                {
                    Target = White_Ball;
                }
                else
                {
                    Target = Red_Ball;
                }
            }
            else if (mission == 2)
            {
                Target             = Pole;
                level             -= bm.PoleLV;
                igm.BetModeMission = BetModeGame.Pole;
            }

            if (level > 0)
            {
                distance += level;
            }

            if (distance > bm.PlusZCount)
            {
                distance = bm.PlusZCount;
            }

            level -= distance;

            if (level > 0)
            {
                position += level;
            }

            testMode1 = "목표물 : " + Target.name + " 미션 레벨 : " + igm.BetLevel;
            Debug.Log("목표물 : " + Target.name);
            testMode2 = "스타팅 : " + startNum + " 거리 : " + distance + " 위치 : " + position + " 크기 : " + scale;
            Debug.Log("스타팅 : " + startNum + " 거리 : " + distance + " 위치 : " + position + " 크기 : " + scale);

            Target.SetActive(true);
            Target.transform.localPosition = bm.GetTargetPosition((BetStartPosition)startNum);

            int plusMinus = UnityEngine.Random.Range(0, 2);

            if (plusMinus == 0)
            {
                plusMinus = -1;
            }
            else
            {
                plusMinus = 1;
            }

            if (startNum == 1 || startNum == 3)
            {
                //1 3
                if (Target.transform.position.x > inGameCamera.transform.position.x)
                {
                    Target.transform.position = new Vector3(Target.transform.position.x + (distance * bm.PlusZ),
                                                            Target.transform.position.y,
                                                            Target.transform.position.z);


                    Target.transform.position = new Vector3(Target.transform.position.x,
                                                            Target.transform.position.y,
                                                            Target.transform.position.z + (position * bm.PlusX) * plusMinus);
                }
                else
                {
                    Target.transform.position = new Vector3(Target.transform.position.x - (distance * bm.PlusZ),
                                                            Target.transform.position.y,
                                                            Target.transform.position.z);


                    Target.transform.position = new Vector3(Target.transform.position.x,
                                                            Target.transform.position.y,
                                                            Target.transform.position.z + (position * bm.PlusX) * plusMinus);
                }
            }
            else
            {
                //0 2
                if (Target.transform.position.z > inGameCamera.transform.position.z)
                {
                    Target.transform.position = new Vector3(Target.transform.position.x,
                                                            Target.transform.position.y,
                                                            Target.transform.position.z + (distance * bm.PlusZ));


                    Target.transform.position = new Vector3(Target.transform.position.x + (position * bm.PlusX) * plusMinus,
                                                            Target.transform.position.y,
                                                            Target.transform.position.z);
                }
                else
                {
                    Target.transform.position = new Vector3(Target.transform.position.x,
                                                            Target.transform.position.y,
                                                            Target.transform.position.z - (distance * bm.PlusZ));


                    Target.transform.position = new Vector3(Target.transform.position.x + (position * bm.PlusX) * plusMinus,
                                                            Target.transform.position.y,
                                                            Target.transform.position.z);
                }
            }
            // 2 0.1
            Target.transform.localScale *= 1 - (scale * bm.Scale);
            targetScale = Target.transform.localScale;
            //카메라 위치 저장
            cameraPosition = inGameCamera.gameObject.transform.localPosition;
            cameraRotation = inGameCamera.gameObject.transform.localEulerAngles;

            targetPosition = Target.transform.localPosition;
            targetRotation = Target.transform.localEulerAngles;
        }