예제 #1
0
        public BallActor(Vector2 a_Position, int a_BallType)
            : base()
        {
            m_Position = a_Position;
            m_IsCollidable = true;
            m_IsDestructable = true;

            m_BallType = (BallType)a_BallType;

            #region Ball Texture
            switch (m_BallType)
            {
                case BallType.Bomb:
                    m_FilePathToTexture = "Sprite/Ball_Bomb";
                    break;

                case BallType.Red:
                    m_FilePathToTexture = "Sprite/Ball_Red";
                    break;

                case BallType.Green:
                   m_FilePathToTexture = "Sprite/Ball_Green";
                    break;

                case BallType.Blue:
                   m_FilePathToTexture = "Sprite/Ball_Blue";
                    break;

                case BallType.Yellow:
                    m_FilePathToTexture = "Sprite/Ball_Yellow";
                    break;
            }
            #endregion
        }
예제 #2
0
 private void ScoreUpdate(BallType type, int score)
 {
     if (_BallType == type)
     {
         _Text.text = " : " + score;
     }
 }
예제 #3
0
 public AddBallEvent(int id, GameCore core, int ballId, BallType ballType, int xPos, int yPos)
     : base(id, GameEventType.AddBall, core)
 {
     _ballId = ballId;
     _ballType = ballType;
     _xPos = xPos;
     _yPos = yPos;
 }
예제 #4
0
 public Ball(BallType ballType, GameObject avatar, int score)
 {
     BallType = ballType;
     Avatar = avatar;
     Score = score;
     SetSpeed ();
     Destroyed = false;
 }
예제 #5
0
 public GameEvent GetAddBallEvent(BallType ballType, int xPos, int yPos)
 {
     var addBallEvent = new AddBallEvent (_core.GetNewEventId(),
                                          _core,
                                          _core.BallManager.GetNewBallId(),
                                          ballType,
                                          xPos,
                                          yPos);
     return addBallEvent;
 }
예제 #6
0
파일: BallFactory.cs 프로젝트: PKode/Kinect
    private static Ball InstantiateBall(BallType ballType)
    {
        GameObject gameObject = null;

        switch (ballType)
        {
            case BallType.FOOT:
                gameObject = (GameObject)GameObject.Instantiate(Instance.footBallPrefab);
                break;

            case BallType.BONUS:
                gameObject = (GameObject)GameObject.Instantiate(Instance.bonusBallPrefab);
                break;
        }

        gameObject.SetActive(false);
        gameObject.transform.parent = BallFactory.Instance.gameObject.transform;
        Ball ball = gameObject.GetComponent<Ball>();
        BallFactory.Instance.ballCount++;
        return ball;
    }
예제 #7
0
    // Use this for initialization
    void Start()
    {
        string modelName;

        //if (Random.value < 0.5)
        //{
        //	modelName = "CubeBall/CubeBall";
        //}
        //else
        //{
        //	modelName = "CylinderBall/CylinderBall";
        //}

        int ballTypeIndex = (int)(Random.value * ballTypes.Length);
        BallType = ballTypes[ballTypeIndex];

        GameObject modelInstance = Instantiate(Resources.Load(BallType.ModelName, typeof(GameObject))) as GameObject;
        modelInstance.transform.SetParent(this.transform, false);

        //GetComponentInParent<AudioSource>().PlayOneShot(    )
        playLaunchSound();
    }
예제 #8
0
파일: BallFactory.cs 프로젝트: PKode/Kinect
    public static Ball GetBall(Vector3 position, BallType ballType)
    {
        Queue<Ball> availableBalls = BallFactory.Instance.availableBallsByType[ballType];

        Ball ball = null;
        if (availableBalls.Count > 0)
        {
            ball = availableBalls.Dequeue();
        }

        if (ball == null)
        {
            // Instantiate a new ball.
            ball = InstantiateBall(ballType);
            //Debug.Log("Number of ball instantiated = " + BallFactory.Instance.ballCount + "\n" + ballType.ToString());
        }

        ball.Position = position;
        ball.gameObject.SetActive(true);

        return ball;
    }
예제 #9
0
        public BallActor(Vector2 a_Position, int a_BallType)
            : base()
        {
            m_Position = a_Position;
            m_IsCollidable = true;
            m_IsDestructable = true;
            m_Speed = 30.0f;
            m_Direction = MathHelper.ToRadians((float)(new Random(seed++).NextDouble() * 360));

            m_BallCollision = new BallCollision(this);

            m_BallType = (BallType)a_BallType;
            #region Ball Texture
            switch (m_BallType)
            {
                case BallType.Bomb:
                    m_FilePathToTexture = "Sprite/Ball_Bomb";
                    break;

                case BallType.Red:
                    m_FilePathToTexture = "Sprite/Ball_Red";
                    break;

                case BallType.Green:
                   m_FilePathToTexture = "Sprite/Ball_Green";
                    break;

                case BallType.Blue:
                   m_FilePathToTexture = "Sprite/Ball_Blue";
                    break;

                case BallType.Yellow:
                    m_FilePathToTexture = "Sprite/Ball_Yellow";
                    break;
            }
            #endregion

            CollisionManager.ActorList.Add(this);
        }
예제 #10
0
    public Ball GetBall(BallType ballType, int ballId, int xPos, int yPos)
    {
        Ball ball;
        switch (ballType)
        {
        case BallType.Small:
            ball = GetSmall();
            break;
        case BallType.Normal:
            ball = GetNormal();
            break;
        case BallType.Big:
            ball = GetBig();
            break;
        default:
            throw new ArgumentException("BallType");
        }

        ball.Id = ballId;
        ball.Avatar.name = ballId.ToString();
        ball.Avatar.transform.position = new Vector3(xPos, yPos, 0);

        return ball;
    }
예제 #11
0
        public void DecodeGameStartMessage(byte[] data, out byte[] playerIds, out PaddleType[] paddleTypes, out BallType ballType, out byte roomMasterId)
        {
            int playerCount = data[0];

            playerIds    = new byte[playerCount];
            paddleTypes  = new PaddleType[playerCount];
            ballType     = (BallType)data[1];
            roomMasterId = data[2];
            for (int i = 0; i < playerCount; i++)
            {
                playerIds[i]   = data[i + 3];
                paddleTypes[i] = (PaddleType)data[i + 3 + playerCount];
            }
        }
예제 #12
0
 public void TutorialSave(BallType type)
 {
     PlayerPrefs.SetInt("tutorialcell" + ((int)type).ToString(), 1);
     PlayerPrefs.Save();
 }
예제 #13
0
        public override void OnStartLocalPlayer()
        {
            if (UnityEngine.SceneManagement.SceneManager.GetActiveScene().name != "Lobby")
            {
                if (!isServer)
                {
//					NetworkManager.singleton.GetComponent<SanicNetworkManager>().raceManager=
//						Instantiate( NetworkManager.singleton.GetComponent<SanicNetworkManager>().raceManagerPrefab);

//					NetworkManager.singleton.GetComponent<SanicNetworkManager>().raceManager.currentState=Sanicball.RaceState.Countdown;
                }
            }

            // esto corre cada vez que instancio a mi proppia pelota, en mi propia identidad.
            //no se instancia con el vecino...
            Debug.Log("Client as been started Locally");


            this.type        = GameObject.Find("SanicNetworkManager").GetComponent <SanicNetworkManager>().tipo;
            this.ctrlType    = GameObject.Find("SanicNetworkManager").GetComponent <SanicNetworkManager>().controlTipo;
            this.characterId = GameObject.Find("SanicNetworkManager").GetComponent <SanicNetworkManager>().personaje;
            this.nickname    = GameObject.Find("SanicNetworkManager").GetComponent <SanicNetworkManager>().nickName;


            if (!isServer)
            {
                if (NetworkManager.singleton.GetComponent <SanicNetworkManager>().matchManager.Players.Count > 0)
                {
                    if (NetworkManager.singleton.GetComponent <SanicNetworkManager>().matchManager.Players[0].BallObject == null)
                    {
                        if (UnityEngine.SceneManagement.SceneManager.GetActiveScene().name == "Lobby")
                        {
                            CmdInit(this.type, this.ctrlType, this.characterId, this.nickname);
                        }
                    }
                    else
                    {
                    }
                }
                else
                {
                    if (UnityEngine.SceneManagement.SceneManager.GetActiveScene().name != "Lobby")
                    {
                        Debug.Log("There are not initialized local players, the player didnt choose a character.");

                        if (isLocalPlayer)
                        {
                            var p = new MatchPlayer("Player._.", ControlType.Keyboard, 0);

                            NetworkManager.singleton.GetComponent <SanicNetworkManager>().matchManager.Players.Add(p);
                        }
                    }
                }


                CmdSetMatchManager();

                NetworkManager.singleton.GetComponent <SanicNetworkManager>().matchManager.Players[0].BallObject = this.GetComponent <Ball>();
            }
            else
            {
                Debug.Log("As Im server, I need to send RpcInit to star the balls in clients");

                RpcInit(this.type, this.ctrlType, this.characterId, this.nickname);
            }
        }
 public override void WhiteBallHitBall(PoolBall ball)
 {
     if (!m_WhiteHitBall)
     {
         m_WhiteHitBallType = ball.ballType;
     }
     base.WhiteBallHitBall(ball);
 }
예제 #15
0
 public static bool BallEnabled(BallType ballType)
 {
     return(GetBallsCount(ballType) != -1);
 }
예제 #16
0
    //튜토리얼 창 뛰움 게임중
    public void TutorialPopup(BallType type)
    {
        if (type != 0)
        {
            Tutorial_basic.SetActive(false);
            TutorialPanel.SetActive(true);
        }

        switch ((int)type)
        {
        case 0:     //초기 튜토리얼
        {
            Tutorial_basic.SetActive(true);
            break;
        }

        case 1:     //일반세포
        {
            TutorialName.text        = Lean.Localization.LeanLocalization.GetTranslationText("healinggerm_name");
            TutorialDescription.text = Lean.Localization.LeanLocalization.GetTranslationText("healing_txt");
            for (int i = 0; i < TutorialCellImage.Length; ++i)
            {
                if (i == 1 && TutorialCellImage[i] != null)
                {
                    TutorialCellImage[i].enabled = true;
                }
                else if (TutorialCellImage[i] != null)
                {
                    TutorialCellImage[i].enabled = false;
                }
            }
            break;
        }

        case 2:    // 종양세포(자라지 않는 암세포)
        {
            TutorialName.text        = Lean.Localization.LeanLocalization.GetTranslationText("devilgerm_name");
            TutorialDescription.text = Lean.Localization.LeanLocalization.GetTranslationText("devil_txt");
            for (int i = 0; i < TutorialCellImage.Length; ++i)
            {
                if (i == 2 && TutorialCellImage[i] != null)
                {
                    TutorialCellImage[i].enabled = true;
                }
                else if (TutorialCellImage[i] != null)
                {
                    TutorialCellImage[i].enabled = false;
                }
            }
            break;
        }

        case 3:    // 암세포(시간에 따라 크기가 커지는 암세포)
        {
            TutorialName.text        = Lean.Localization.LeanLocalization.GetTranslationText("expanding_germ_name");
            TutorialDescription.text = Lean.Localization.LeanLocalization.GetTranslationText("expanding_txt");
            for (int i = 0; i < TutorialCellImage.Length; ++i)
            {
                if (i == 3 && TutorialCellImage[i] != null)
                {
                    TutorialCellImage[i].enabled = true;
                }
                else if (TutorialCellImage[i] != null)
                {
                    TutorialCellImage[i].enabled = false;
                }
            }
            break;
        };

        case 4:    // 분열하는 세포
        {
            {
                TutorialName.text        = Lean.Localization.LeanLocalization.GetTranslationText("zombiegerm_name");
                TutorialDescription.text = Lean.Localization.LeanLocalization.GetTranslationText("zombie_txt");
                for (int i = 0; i < TutorialCellImage.Length; ++i)
                {
                    if (i == 4 && TutorialCellImage[i] != null)
                    {
                        TutorialCellImage[i].enabled = true;
                    }
                    else if (TutorialCellImage[i] != null)
                    {
                        TutorialCellImage[i].enabled = false;
                    }
                }
                break;
            };
        };

        case 5:
        {
            {
                TutorialName.text        = Lean.Localization.LeanLocalization.GetTranslationText("shield_germ");
                TutorialDescription.text = Lean.Localization.LeanLocalization.GetTranslationText("Shield_txt");
                for (int i = 0; i < TutorialCellImage.Length; ++i)
                {
                    if (i == 5 && TutorialCellImage[i] != null)
                    {
                        TutorialCellImage[i].enabled = true;
                    }
                    else if (TutorialCellImage[i] != null)
                    {
                        TutorialCellImage[i].enabled = false;
                    }
                }
                break;
            };
        };         // 체력없는 세포(방패)

        case 6:
        {
            {
                TutorialName.text        = Lean.Localization.LeanLocalization.GetTranslationText("Cancer_name");
                TutorialDescription.text = Lean.Localization.LeanLocalization.GetTranslationText("cancer_txt");
                for (int i = 0; i < TutorialCellImage.Length; ++i)
                {
                    if (i == 6 && TutorialCellImage[i] != null)
                    {
                        TutorialCellImage[i].enabled = true;
                    }
                    else if (TutorialCellImage[i] != null)
                    {
                        TutorialCellImage[i].enabled = false;
                    }
                }
                break;
            };
        };         // 보스

        case 7:
        {
            {
                TutorialName.text        = Lean.Localization.LeanLocalization.GetTranslationText("weakness");
                TutorialDescription.text = Lean.Localization.LeanLocalization.GetTranslationText("weakness_txt");
                for (int i = 0; i < TutorialCellImage.Length; ++i)
                {
                    if (i == 7 && TutorialCellImage[i] != null)
                    {
                        TutorialCellImage[i].enabled = true;
                    }
                    else if (TutorialCellImage[i] != null)
                    {
                        TutorialCellImage[i].enabled = false;
                    }
                }
                break;
            };
        };         // 보스 약점

        case 8:
        {
            {
                TutorialName.text        = Lean.Localization.LeanLocalization.GetTranslationText("vaccine_germ");
                TutorialDescription.text = Lean.Localization.LeanLocalization.GetTranslationText("vaccine_txt");
                for (int i = 0; i < TutorialCellImage.Length; ++i)
                {
                    if (i == 8 && TutorialCellImage[i] != null)
                    {
                        TutorialCellImage[i].enabled = true;
                    }
                    else if (TutorialCellImage[i] != null)
                    {
                        TutorialCellImage[i].enabled = false;
                    }
                }
                break;
            };
        }
            ;        // 죽으면 미사일이 되서 날아감

        case 9:
        {
            {
                {
                    TutorialName.text        = Lean.Localization.LeanLocalization.GetTranslationText("spongegerm_name");
                    TutorialDescription.text = Lean.Localization.LeanLocalization.GetTranslationText("sponge_txt");
                    for (int i = 0; i < TutorialCellImage.Length; ++i)
                    {
                        if (i == 9 && TutorialCellImage[i] != null)
                        {
                            TutorialCellImage[i].enabled = true;
                        }
                        else if (TutorialCellImage[i] != null)
                        {
                            TutorialCellImage[i].enabled = false;
                        }
                    }
                    break;
                };
            }
        };        // 일정 수치 맞으면 증가하다가 없어짐
        }
    }
예제 #17
0
 public void CurrentBallAdd(BallType type, int value)
 {
     switch (type)
     {
         case BallType.btRed:
             _CurrentRedBall += value;
             if (CurrentBallChanged != null)
                 CurrentBallChanged(type, _CurrentRedBall);
             break;
         case BallType.btGreen:
             _CurrentGreenBall += value;
             if (CurrentBallChanged != null)
                 CurrentBallChanged(type, _CurrentGreenBall);
             break;
         case BallType.btCyan:
             _CurrentCyanBall += value;
             if (CurrentBallChanged != null)
                 CurrentBallChanged(type, _CurrentCyanBall);
             break;
     }
 }
예제 #18
0
 internal void Init(BallType type, int points)
 {
     this.type   = type;
     this.points = points;
 }
예제 #19
0
 protected virtual void Awake()
 {
     m_TargetBallType = BallType.NONE;
     playerID = GetInstanceID();
     playerName.text = name;
     //m_Outline.enabled = false;
     PoolRulesBase.onNewTurn += TurnBegin;
 }
예제 #20
0
    public void UpdateBallIcon()
    {
        if (m_TargetBallType == BallType.NONE)
            return;

        if(m_TargetBalls.Count != 0)
        {
            for (int i = 0; i < m_TargetBalls.Count; )
            {
                if (m_TargetBalls[i].BallState == PoolBall.State.POTTED)
                {
                    Transform t = m_SlotsRoot.transform.FindChild(m_TargetBalls[i].GetBallID().ToString());
                    if (t) Destroy(t.gameObject);

                    m_TargetBalls.RemoveAt(i);
                }
                else  i++;
            }
            if (m_TargetBalls.Count == 0 && m_TargetBallType != BallType.BLACK)
                m_TargetBallType = BallType.BLACK;
        }

        if(m_TargetBalls.Count == 0)
        {
            if (m_TargetBallType == BallType.BLACK) AddBalls(8, 8);
            if (m_TargetBallType == BallType.SOLID) AddBalls(1, 7);
            if (m_TargetBallType == BallType.STRIPE) AddBalls(9, 15);
        }
    }
예제 #21
0
 public virtual void OnChanged_Type(BallType value)
 {
 }
예제 #22
0
        public Ball SpawnBall(int position, BallType ballType, ControlType ctrlType, int character, string nickname)
        {
            float characterSize = ActiveData.Characters[character].ballSize;

            return(SpawnBall(GetSpawnPoint(position, characterSize / 2f), transform.rotation, ballType, ctrlType, character, nickname));
        }
예제 #23
0
 public BallData(BallType ball, ObjectiveType objective = ObjectiveType.NONE)
 {
     BallType      = ball;
     ObjectiveType = objective;
 }
예제 #24
0
 public void SetKind(BallType ballType)
 {
     kind = ballType;
     SetColor();
 }
예제 #25
0
 public void CurrentScoreAdd(BallType type)
 {
     switch (type)
     {
         case BallType.btRed:
             CurrentScoreAdd(BALL_RED_SCORE);
             break;
         case BallType.btGreen:
             CurrentScoreAdd(BALL_GREEN_SCORE);
             break;
         case BallType.btCyan:
             CurrentScoreAdd(BALL_CYAN_SCORE);
             break;
     }
 }
예제 #26
0
 public override int GetHashCode()
 {
     return(BallType.GetHashCode() + ObjectiveType.GetHashCode());
 }
예제 #27
0
 public void AddBall(int id, BallType ballType, int xPos, int yPos)
 {
     Balls.Add (_ballFactory.GetBall(ballType, id, xPos, yPos));
 }
예제 #28
0
    private Ball GetBallTemplate(BallType ballType, int score)
    {
        var avatar = new GameObject ("Ball");
        var ball = new Ball (ballType, avatar, score);

        avatar.transform.position = new Vector3 (5, 15, 0);

        return ball;
    }
 protected override void TurnBegin()
 {
     base.TurnBegin();
     m_Time = m_TimePerRound;
     m_Countdown = true;
     m_CueBallHitRail = false;
     m_WhiteHitBallType = BallType.NONE;
     m_HittingRailBallsCount = 0;
     if(m_HandleWhiteball)
     {
         State = GlobalState.DRAG_WHITEBALL;
     }
     else
     {
         State = GlobalState.IDLE;
     }
     for (int i = 0, length = m_Players.Length; i < length; i++)
     {
         m_Players[i].UpdateBallIcon();
     }
     CurrentPlayer.Begin();
 }
예제 #30
0
 private Sprite getBallTypeSprite(BallType ballType)
 {
     return(main.BallTypeSprites[ballType]);
 }
예제 #31
0
파일: BallFactory.cs 프로젝트: PKode/Kinect
    private static void PreinstantiateBalls(BallType ballType, int numberOfBallsToPreinstantiate)
    {
        Queue<Ball> balls = BallFactory.Instance.availableBallsByType[ballType];
        for (int index = 0; index < numberOfBallsToPreinstantiate; index++)
        {
            Ball ball = InstantiateBall(ballType);
            if (ball == null)
            {
                Debug.LogError(string.Format("Failed to instantiate {0} balls.", numberOfBallsToPreinstantiate));
                break;
            }

            balls.Enqueue(ball);
        }
    }
예제 #32
0
    public void StartEffect(BallType ballType, BallInfo baseBall, List <BallInfo> elimitBalls, bool isSmallLine)
    {
        _BaseBall = baseBall;

        ResetPos();

        SetMaxPos(elimitBalls);

        if (isSmallLine)
        {
            _UpLarge.SetActive(false);
            _DownLarge.SetActive(false);
            _LeftLarge.SetActive(false);
            _RightLarge.SetActive(false);

            _UpSmall.SetActive(true);
            _DownSmall.SetActive(true);
            _LeftSmall.SetActive(true);
            _RightSmall.SetActive(true);
        }
        else
        {
            _UpLarge.SetActive(true);
            _DownLarge.SetActive(true);
            _LeftLarge.SetActive(true);
            _RightLarge.SetActive(true);

            _UpSmall.SetActive(false);
            _DownSmall.SetActive(false);
            _LeftSmall.SetActive(false);
            _RightSmall.SetActive(false);
        }

        switch (ballType)
        {
        case BallType.LineClumn:
        case BallType.LineClumnAuto:
        case BallType.LineClumnEnlarge:
        case BallType.LineClumnHitTrap:
        case BallType.LineClumnLighting:
        case BallType.LineClumnReact:
            _UP.SetActive(true);
            _Down.SetActive(true);
            break;

        case BallType.LineRow:
        case BallType.LineRowAuto:
        case BallType.LineRowEnlarge:
        case BallType.LineRowHitTrap:
        case BallType.LineRowLighting:
        case BallType.LineRowReact:
            _Left.SetActive(true);
            _Right.SetActive(true);
            break;

        case BallType.LineCross:
        case BallType.LineCrossAuto:
        case BallType.LineCrossEnlarge:
        case BallType.LineCrossHitTrap:
        case BallType.LineCrossLighting:
        case BallType.LineCrossReact:
            _UP.SetActive(true);
            _Down.SetActive(true);
            _Left.SetActive(true);
            _Right.SetActive(true);
            break;
        }
    }
예제 #33
0
 public void Clear()
 {
     _BallType   = BallType.None;
     _ElimitFlag = 0;
     ClearSP();
 }
예제 #34
0
        public void RpcInit(BallType type, ControlType ctrlType, int characterId, string nickname)
        {
            this.type        = type;
            this.ctrlType    = ctrlType;
            this.characterId = characterId;
            this.nickname    = nickname;


            Debug.Log("We re running RPCInit character is _ " + this.characterId);

            Up = Vector3.up;

            //Set up drifty smoke
            smoke            = Instantiate(prefabs.Smoke);
            smoke.target     = this;
            smoke.DriftAudio = sounds.Brake;

            //Grab reference to Rigidbody
            rb = GetComponent <Rigidbody>();
            //Set angular velocity (This is necessary for fast)
            rb.maxAngularVelocity = 1000f;

            //Set object name
            gameObject.name = nickname;

            //Set character
            if (CharacterId >= 0 && CharacterId < Data.ActiveData.Characters.Length)
            {
                SetCharacter(Data.ActiveData.Characters[CharacterId]);
            }

            //Create objects and components based on ball type
            if (type == BallType.Player && cameraBall == null && isLocalPlayer)
            {
                OmniCamera newCam = Instantiate(prefabs.Camera);
                newCam.Target   = rb;
                newCam.CtrlType = ctrlType;
                PivotCamera oldCam = Instantiate(prefabs.OldCamera);
                oldCam.Target   = rb;
                oldCam.CtrlType = ctrlType;

                //Create camera
                if (Data.ActiveData.GameSettings.useOldControls)
                {
                    cameraBall = oldCam;
                    newCam.gameObject.SetActive(false);

                    ((PivotCamera)cameraBall).UseMouse = ctrlType == ControlType.Keyboard;
                }
                else
                {
                    cameraBall = newCam;
                    oldCam.gameObject.SetActive(false);
                }
                cameraBall.Target   = rb;
                cameraBall.CtrlType = ctrlType;

                if (CameraCreatedEvent != null)
                {
                    CameraCreatedEvent(this, new CameraCreationArgs(cameraBall, oldCam.gameObject, newCam.gameObject));
                }
            }
            if (type == BallType.LobbyPlayer)
            {
                //Make the lobby camera follow this ball
                var cam = FindObjectOfType <LobbyCamera>();
                if (cam)
                {
                    cam.AddBall(this);
                }
            }
            if ((type == BallType.Player || type == BallType.LobbyPlayer && isLocalPlayer) && input == null)
            {
                //Create input component
                input = gameObject.AddComponent <BallControlInput>();
            }
            if (type == BallType.AI)
            {
                //Create AI component
                var ai = gameObject.AddComponent <BallControlAI>();
                ai.pathToFollow = FindObjectOfType <Path>();

                //Create target for the AI
                AITarget pFollower = Instantiate(prefabs.AiTarget);
                pFollower.GetComponent <PathFollower>().path = ai.pathToFollow;
                pFollower.stupidness = ai.stupidness;
                pFollower.GetComponent <Patroller>().target = gameObject;
                ai.target = pFollower;
            }

            if (!isServer)
            {
            }
        }
예제 #35
0
 public void SetBallType(BallType ballType)
 {
     _BallType = ballType;
 }
예제 #36
0
 void SetBackgroundColor()
 {
     backgroundType = currentBallTypes [Random.Range(0, currentBallTypes.Count)];
     background.GetComponent <Renderer>().material.color = ballManager.GetBackground(backgroundType);
     background.GetComponent <SpriteRenderer>().sprite   = ballManager.GetRndBackImg();
 }
예제 #37
0
    private BallInfoSPBase GetBallInfoSP(BallType ballType, string[] spArgs)
    {
        BallInfoSPBase initBall = null;

        switch (ballType)
        {
        case BallType.Ice:
            initBall = new BallInfoSPTrapIce();
            initBall.SetBallInfo(this);
            initBall.SetParam(spArgs);
            break;

        case BallType.Clod:
            initBall = new BallInfoSPTrapClod();
            initBall.SetBallInfo(this);
            initBall.SetParam(spArgs);
            break;

        case BallType.Stone:
            initBall = new BallInfoSPTrapStone();
            initBall.SetBallInfo(this);
            initBall.SetParam(spArgs);
            break;

        case BallType.Posion:
            initBall = new BallInfoSPTrapPosion();
            initBall.SetBallInfo(this);
            initBall.SetParam(spArgs);
            break;

        case BallType.Iron:
            initBall = new BallInfoSPTrapIron();
            initBall.SetBallInfo(this);
            initBall.SetParam(spArgs);
            break;

        case BallType.BombSmall1:
            initBall = new BallInfoSPBombSmall();
            initBall.SetBallInfo(this);
            initBall.SetParam(spArgs);
            break;

        case BallType.BombBig1:
            initBall = new BallInfoSPBombBig();
            initBall.SetBallInfo(this);
            initBall.SetParam(spArgs);
            break;

        case BallType.BombSmallEnlarge1:
            initBall = new BallInfoSPBombSmallEnlarge();
            initBall.SetBallInfo(this);
            initBall.SetParam(spArgs);
            break;

        case BallType.BombBigEnlarge:
            initBall = new BallInfoSPBombBigEnlarge();
            initBall.SetBallInfo(this);
            initBall.SetParam(spArgs);
            break;

        case BallType.BombSmallHitTrap:
            initBall = new BallInfoSPBombSmallTrap();
            initBall.SetBallInfo(this);
            initBall.SetParam(spArgs);
            break;

        case BallType.BombBigHitTrap:
            initBall = new BallInfoSPBombBigTrap();
            initBall.SetBallInfo(this);
            initBall.SetParam(spArgs);
            break;

        case BallType.BombSmallReact:
            initBall = new BallInfoSPBombSmallReact();
            initBall.SetBallInfo(this);
            initBall.SetParam(spArgs);
            break;

        case BallType.BombBigReact:
            initBall = new BallInfoSPBombBigReact();
            initBall.SetBallInfo(this);
            initBall.SetParam(spArgs);
            break;

        case BallType.BombSmallLighting:
            initBall = new BallInfoSPBombSmallLighting();
            initBall.SetBallInfo(this);
            initBall.SetParam(spArgs);
            break;

        case BallType.BombBigLighting:
            initBall = new BallInfoSPBombBigLighting();
            initBall.SetBallInfo(this);
            initBall.SetParam(spArgs);
            break;

        case BallType.BombSmallAuto:
            initBall = new BallInfoSPBombSmallAuto();
            initBall.SetBallInfo(this);
            initBall.SetParam(spArgs);
            break;

        case BallType.BombBigAuto:
            initBall = new BallInfoSPBombBigAuto();
            initBall.SetBallInfo(this);
            initBall.SetParam(spArgs);
            break;

        case BallType.LineRow:
            initBall = new BallInfoSPLineRow();
            initBall.SetBallInfo(this);
            initBall.SetParam(spArgs);
            break;

        case BallType.LineClumn:
            initBall = new BallInfoSPLineClumn();
            initBall.SetBallInfo(this);
            initBall.SetParam(spArgs);
            break;

        case BallType.LineCross:
            initBall = new BallInfoSPLineCross();
            initBall.SetBallInfo(this);
            initBall.SetParam(spArgs);
            break;

        case BallType.LineRowEnlarge:
            initBall = new BallInfoSPLineRowEnlarge();
            initBall.SetBallInfo(this);
            initBall.SetParam(spArgs);
            break;

        case BallType.LineClumnEnlarge:
            initBall = new BallInfoSPLineClumnEnlarge();
            initBall.SetBallInfo(this);
            initBall.SetParam(spArgs);
            break;

        case BallType.LineCrossEnlarge:
            initBall = new BallInfoSPLineCrossEnlarge();
            initBall.SetBallInfo(this);
            initBall.SetParam(spArgs);
            break;

        case BallType.LineRowHitTrap:
            initBall = new BallInfoSPLineRowTrap();
            initBall.SetBallInfo(this);
            initBall.SetParam(spArgs);
            break;

        case BallType.LineClumnHitTrap:
            initBall = new BallInfoSPLineClumnTrap();
            initBall.SetBallInfo(this);
            initBall.SetParam(spArgs);
            break;

        case BallType.LineCrossHitTrap:
            initBall = new BallInfoSPLineCrossTrap();
            initBall.SetBallInfo(this);
            initBall.SetParam(spArgs);
            break;

        case BallType.LineRowReact:
            initBall = new BallInfoSPLineRowReact();
            initBall.SetBallInfo(this);
            initBall.SetParam(spArgs);
            break;

        case BallType.LineClumnReact:
            initBall = new BallInfoSPLineClumnReact();
            initBall.SetBallInfo(this);
            initBall.SetParam(spArgs);
            break;

        case BallType.LineCrossReact:
            initBall = new BallInfoSPLineCrossReact();
            initBall.SetBallInfo(this);
            initBall.SetParam(spArgs);
            break;

        case BallType.LineRowLighting:
            initBall = new BallInfoSPLineRowLighting();
            initBall.SetBallInfo(this);
            initBall.SetParam(spArgs);
            break;

        case BallType.LineClumnLighting:
            initBall = new BallInfoSPLineClumnLighting();
            initBall.SetBallInfo(this);
            initBall.SetParam(spArgs);
            break;

        case BallType.LineCrossLighting:
            initBall = new BallInfoSPLineCrossLighting();
            initBall.SetBallInfo(this);
            initBall.SetParam(spArgs);
            break;

        case BallType.LineRowAuto:
            initBall = new BallInfoSPLineRowAuto();
            initBall.SetBallInfo(this);
            initBall.SetParam(spArgs);
            break;

        case BallType.LineClumnAuto:
            initBall = new BallInfoSPLineClumnAuto();
            initBall.SetBallInfo(this);
            initBall.SetParam(spArgs);
            break;

        case BallType.LineCrossAuto:
            initBall = new BallInfoSPLineCrossAuto();
            initBall.SetBallInfo(this);
            initBall.SetParam(spArgs);
            break;

        case BallType.RPGHP:
            initBall = new BallInfoSPRPGHP();
            initBall.SetBallInfo(this);
            initBall.SetParam(spArgs);
            break;
        }

        return(initBall);
    }
예제 #38
0
 public void ThrowBallLocal(BallType ballType)
 {
     balls.Remove(ballType);
     OnBallsChange.Invoke(balls);
 }
예제 #39
0
    public GameObject CreateBooster(BallType type, Vector3 position)
    {
        Object ball = creator.CreateNewBoost(type);

        return(Publish(ball, position));
    }
예제 #40
0
 public virtual void OnClearInfo()
 {
     _BallSPType = BallType.None;
     _BallInfo   = null;
 }
예제 #41
0
 public static Texture2D GetBallSprite(BallType type)
 {
     return(ballSprites[(int)type]);
 }
예제 #42
0
파일: LevelCore.cs 프로젝트: idDizel/Lines
 public void GetBallByType(BallType type, out GameObject gameObject)
 {
     this.mappedPrefabs.TryGetValue(type, out gameObject);
 }
예제 #43
0
        public void AddBall(BallType ballType, RunsType runsType, BoundaryType boundaryType, int runs,
                            CricketPlayer playerBowler, CricketPlayer playreBtsmen, bool isDismissal, CricketPlayer dismissedPlayer, CricketPlayer playerFielder, DisMissalType disMissalType)
        {
            var batsmen = this.CurrentInnings().BattingTeamPlayers.FirstOrDefault(x => x.Id == playreBtsmen.Id);
            var bowler  = this.CurrentInnings().BowlingTeamPlayers.FirstOrDefault(x => x.Id == playerBowler.Id);


            var innings = this.CurrentInnings();
            var over    = this.CurrentOver();
            var ball    = new Ball
            {
                BallAttemptStatus = BallAttemptStatus.InProgress,
                BallType          = ballType,
                RunsType          = runsType,
                BoundaryType      = boundaryType,
                Runs = runs,

                IsDismissal   = isDismissal,
                DisMissalType = disMissalType,
            };

            if (batsmen != null)
            {
                ball.BatsmenId = batsmen.Id;
            }
            if (bowler != null)
            {
                ball.BowlerId = bowler.Id; bowler.BallsBowled++;
            }
            if (playerFielder != null)
            {
                ball.FielderId = playerFielder.Id;
            }
            switch (ball.BallType)
            {
            case BallType.Legitimate:
                ball.BallNumber        = CurrentOver().Balls.Count(x => x.IsFinished) + 1;
                ball.BallAttemptNumber = 1;
                ball.IsFinished        = true;
                innings.Runs          += runs;
                over.Runs += runs;
                batsmen.BallsFaced++;
                batsmen.Runs        += runs;
                bowler.RunsConceded += runs;
                if (ball.Runs == 0)
                {
                    batsmen.NumberOfDotBalls++;
                    bowler.NumberOfDotBallsBowled++;
                    innings.NumberOfDotBalls++;
                }
                break;

            case BallType.Wide:
                ball.Extras            = this.WideValue + runs;
                ball.BallAttemptNumber = ball.BallAttemptNumber + 1;
                ball.BallNumber        = CurrentOver().Balls.Count(x => x.IsFinished);
                innings.Wides         += 1;
                innings.WideRuns      += this.WideValue + runs;
                over.Extras           += this.WideValue + runs;
                bowler.NumberOfWidesBowled++;
                bowler.RunsConceded += this.WideValue + runs;
                break;

            case BallType.NoBall:
                if (ball.RunsType == RunsType.Run)
                {
                    ball.Extras         = this.NoBallValue;
                    ball.Runs           = runs;
                    innings.NoBallRuns += this.NoBallValue;
                    innings.Runs       += runs;
                    batsmen.Runs       += runs;
                }
                else
                {
                    ball.Extras         = this.NoBallValue + runs;
                    innings.NoBallRuns += this.NoBallValue + runs;
                }
                ball.BallAttemptNumber = ball.BallAttemptNumber + 1;
                ball.BallNumber        = CurrentOver().Balls.Count(x => x.IsFinished);
                innings.NoBalls       += 1;
                over.Extras           += this.NoBallValue + runs;
                batsmen.BallsFaced++;
                bowler.NumberOfNoBallsBowled++;
                bowler.RunsConceded += this.NoBallValue + runs;
                break;
            }

            switch (ball.RunsType)
            {
            case RunsType.Byes:
                ball.Extras   = runs;
                ball.Runs     = 0;
                innings.Byes += runs;
                over.Extras   = runs;
                break;

            case RunsType.LegByes:
                ball.Extras          = runs;
                ball.Runs            = 0;
                innings.Legbyes     += runs;
                over.Extras          = runs;
                bowler.RunsConceded += runs;
                break;
            }
            switch (ball.BoundaryType)
            {
            case BoundaryType.Four:
                innings.NumberOfFours++;
                batsmen.NumberOfFours++;
                bowler.NumberOfFoursConceded++;
                break;

            case BoundaryType.Six:
                innings.NumberOfSixers++;
                batsmen.NumberOfSixers++;
                bowler.NumberOfSixersConceded++;
                break;
            }

            if (isDismissal)
            {
                switch (disMissalType)
                {
                case DisMissalType.Bowled:
                case DisMissalType.Caught:
                case DisMissalType.StumpOut:
                case DisMissalType.HitWicket:
                case DisMissalType.Lbw:
                    bowler.NumberOfWickets++;
                    break;
                }
                if (dismissedPlayer != null)
                {
                    batsmen.Dismissed = true;
                }
            }

            innings.NumberOfOversBowled = over.Number - 1 + "." + ball.BallNumber;

            CurrentOver().Balls.Add(ball);

            var striker    = this.CurrentInnings().Striker;
            var nonStriker = this.CurrentInnings().NonStriker;

            if (IsOdd(ball.Runs))
            {
                this.CurrentInnings().Striker    = nonStriker;
                this.CurrentInnings().NonStriker = striker;
            }
            if (isDismissal)
            {
                if (dismissedPlayer != null && dismissedPlayer.Id == striker.Id)
                {
                    CurrentInnings().Striker = null;
                }
                else
                {
                    CurrentInnings().NonStriker = null;
                }
            }

            var timelineAction = new TimelineAction
            {
                InningsNumber     = innings.InningsNumber,
                OverNumber        = over.Number,
                BallNumber        = ball.BallNumber,
                BallAttemptNumber = ball.BallAttemptNumber,
                BallType          = ball.BallType,
                RunsType          = ball.RunsType,
                Runs = ball.Runs
            };

            if (batsmen != null)
            {
                timelineAction.BatsmenId = batsmen.Id;
            }
            if (bowler != null)
            {
                timelineAction.BowlerId = bowler.Id; bowler.BallsBowled++;
            }
            if (playerFielder != null)
            {
                timelineAction.FielderId = playerFielder.Id;
            }
            this.CurrentInnings().TimelineActions.Add(timelineAction);
        }
예제 #44
0
    public override void ShowBallInfo(BallInfo ballInfo, bool isInner)
    {
        _SPShowGO.SetActive(true);

        _Color1Effect.SetActive(false);
        _Color2Effect.SetActive(false);
        _Color3Effect.SetActive(false);
        _Color4Effect.SetActive(false);
        _Color5Effect.SetActive(false);
        _ColorEmptyEffect.SetActive(false);


        switch (ballInfo.BallType)
        {
        case BallType.Color1:
            _Color1Effect.SetActive(true);
            break;

        case BallType.Color2:
            _Color2Effect.SetActive(true);
            break;

        case BallType.Color3:
            _Color3Effect.SetActive(true);
            break;

        case BallType.Color4:
            _Color4Effect.SetActive(true);
            break;

        case BallType.Color5:
            _Color5Effect.SetActive(true);
            break;

        case BallType.ColorEmpty:
            _ColorEmptyEffect.SetActive(true);
            break;

        case BallType.None:
            _ColorEmptyEffect.SetActive(true);
            break;
        }

        _LineUp.SetActive(false);
        _LineDown.SetActive(false);
        _LineLeft.SetActive(false);
        _LineRight.SetActive(false);

        BallType ballType = ballInfo.BallSPType;

        if (isInner)
        {
            ballType = ballInfo.IncludeBallSPType;
        }
        switch (ballType)
        {
        case BallType.LineClumn:
        case BallType.LineClumnEnlarge:
        case BallType.LineClumnReact:
        case BallType.LineClumnHitTrap:
        case BallType.LineClumnLighting:
        case BallType.LineClumnAuto:
            _LineUp.SetActive(true);
            _LineDown.SetActive(true);
            break;

        case BallType.LineRow:
        case BallType.LineRowEnlarge:
        case BallType.LineRowReact:
        case BallType.LineRowHitTrap:
        case BallType.LineRowLighting:
        case BallType.LineRowAuto:
            _LineLeft.SetActive(true);
            _LineRight.SetActive(true);
            break;

        case BallType.LineCross:
        case BallType.LineCrossEnlarge:
        case BallType.LineCrossReact:
        case BallType.LineCrossHitTrap:
        case BallType.LineCrossLighting:
        case BallType.LineCrossAuto:
            _LineUp.SetActive(true);
            _LineDown.SetActive(true);
            _LineLeft.SetActive(true);
            _LineRight.SetActive(true);
            break;
        }
    }
예제 #45
0
 public void ChangeType(BallType newType)
 {
     _type = newType;
     InitColor();
 }
예제 #46
0
 public override void TransformsTo(BallType ballType)
 {
 }
예제 #47
0
 public abstract void TransformsTo(BallType ballType);
예제 #48
0
 public BallData(int _ID, Vector3 _Position, Rect _pRect, BallType _type)
 {
     ID = _ID;
     Position = _Position;
     pRect = _pRect;
     Type = _type;
 }
예제 #49
0
 public static Sprite GetBallTypeSprite(BallType ballType)
 {
     return(main.getBallTypeSprite(ballType));
 }
예제 #50
0
파일: LevelCore.cs 프로젝트: idDizel/Lines
 public void MapPrefab(GameObject gameObject, BallType type)
 {
     this.mappedPrefabs.Add(type, gameObject);
 }
 private bool AnyBallWithTypeEnterPocket(BallType type)
 {
     if(type == BallType.NONE)
     {
         if (m_PottedBallListThisRound.Count > 0)
             return true;
         else
             return false;
     }
     else
     {
         for (int i = 0, count = m_PottedBallListThisRound.Count; i < count; i++)
         {
             if (m_PottedBallListThisRound[i].ballType == type)
                 return true;
         }
         return false;
     }
 }