コード例 #1
0
        public void AddCrossWay(BallInfo ballInfo)
        {
            if (_CrossWay.Contains(ballInfo))
            {
                return;
            }

            _CrossWay.Add(ballInfo);
            _SlotCount = -1;
        }
コード例 #2
0
        public void AddGate(BallInfo ballInfo)
        {
            if (_Gate.Contains(ballInfo))
            {
                return;
            }

            _Gate.Add(ballInfo);
            _SlotCount = -1;
        }
コード例 #3
0
 public virtual void SetBallIncludeSPType(BallInfo ballInfo)
 {
     if (ballInfo == null)
     {
         _BallSPType = BallType.None;
         return;
     }
     _BallInfo   = ballInfo;
     _BallSPType = ballInfo.IncludeBallSPType;
 }
コード例 #4
0
        /// <summary>
        /// 计算需要的速度
        /// </summary>
        /// <param name="club">所用的球杆</param>
        /// <param name="ball">所使用的球</param>
        /// <param name="startPos">发球点</param>
        /// <param name="RingPos">五环的位置,第一个反弹点</param>
        /// <returns></returns>
        public Vector3 CalcNeedSpeed(ClubInfo club, BallInfo ball, Vector3 startPosition, Vector3 endPosition, float hookAngle = 0)
        {
            float sinElevationRad = 0;
            float cosElevationRad = 0;

            GetClubElevationRad(club.Type, out sinElevationRad, out cosElevationRad);
            //位移
            Vector3 deltaPosition = endPosition - startPosition;

            //角
            if (deltaPosition.z == 0)
            {
                return(Vector3.zero);
            }
            float HorizonRad    = Mathf.Atan(deltaPosition.x / deltaPosition.z);
            float CosHorizonRad = Mathf.Cos(HorizonRad);
            float SinHorizonRad = Mathf.Sin(HorizonRad);

            //公式算出初速度
            float divisor = (2 * deltaPosition.y * cosElevationRad * cosElevationRad * CosHorizonRad * CosHorizonRad
                             - 2 * deltaPosition.z * sinElevationRad * cosElevationRad * CosHorizonRad);

            if (divisor == 0)
            {
                return(Vector3.zero);
            }
            float squareV = (deltaPosition.z * deltaPosition.z * LogicConstantData.Gravity) / divisor;
            float v       = Mathf.Sqrt(Mathf.Abs(squareV));

            //初速度分量
            float vx = v * cosElevationRad * SinHorizonRad;
            float vy = v * sinElevationRad;
            float vz = v * cosElevationRad * CosHorizonRad;

            //反向时的处理
            Vector3 dir = deltaPosition.normalized;

            if (dir.z < 0)
            {
                vz        = -vz;
                vx        = -vx;
                hookAngle = -hookAngle;
            }

            //计算曲球初速度和加速度
            //CalcHook(vy, vz, deltaPosition.z, hookAngle);

            //计算精准度风切校正
            //CalcAccuracyRevise(vx, vz);

            //最终初速度
            Vector3 velocity = new Vector3(vx, vy, vz);

            return(velocity);
        }
コード例 #5
0
    public override void ShowBallInfo(BallInfo ballInfo, bool isInner)
    {
        _Color1Armature.gameObject.SetActive(false);
        _Color2Armature.gameObject.SetActive(false);
        _Color3Armature.gameObject.SetActive(false);
        _Color4Armature.gameObject.SetActive(false);
        _Color5Armature.gameObject.SetActive(false);
        _ColorEmptyArmature.gameObject.SetActive(false);

        switch (ballInfo.BallType)
        {
        case BallType.Color1:
            ClearBall();
            _NormalBall1.SetActive(true);

            break;

        case BallType.Color2:
            ClearBall();
            _NormalBall2.SetActive(true);
            _Color2Armature.gameObject.SetActive(false);
            break;

        case BallType.Color3:
            ClearBall();
            _NormalBall3.SetActive(true);
            _Color3Armature.gameObject.SetActive(false);
            break;

        case BallType.Color4:
            ClearBall();
            _NormalBall4.SetActive(true);
            _Color4Armature.gameObject.SetActive(false);
            break;

        case BallType.Color5:
            ClearBall();
            _NormalBall5.SetActive(true);
            _Color5Armature.gameObject.SetActive(false);
            break;

        case BallType.ColorEmpty:
            ClearBall();
            _NormalBallEmpty.SetActive(true);
            _ColorEmptyArmature.gameObject.SetActive(false);
            break;

        case BallType.None:
            ClearBall();
            break;
        }

        //_BallText.text = ((int)ballInfo.BallType).ToString();
        _BallText.text = (int)ballInfo.Pos.x + "," + (int)ballInfo.Pos.y;
    }
コード例 #6
0
    void FixedUpdate()
    {
        if (_replayManager.isRecording)
        {
            ballInfo = ballPhysics.UpdateBallInfo(ballInfo, Time.fixedDeltaTime, _isDropshot);

            CheckCollisions();

            UpdateFromBallInfo();
        }
    }
コード例 #7
0
ファイル: BallController.cs プロジェクト: arahis/Balls
 public BallInfo CreateBallInfo()
 {
     var info = new BallInfo
     {
         LocalPosition = CurrentPosition,
         SpawnPosition = SpawnPosition,
         Size = Size,
         Index = Index
     };
     return info;
 }
コード例 #8
0
ファイル: Player.cs プロジェクト: uvbs/DDTank-3.0
        public void SetBall(int ballId)
        {
            if (ballId != m_currentBall.ID)
            {
                m_currentBall = BallMgr.FindBall(ballId);
                GSPacketIn pkg = m_player.Out.SendGameUpdateBall(this);
                m_game.SendToAll(pkg, m_player);

                BallCount = m_currentBall.Amount;
            }
        }
コード例 #9
0
 public override void SetParam(string[] param)
 {
     if (param.Length > 1)
     {
         ElimitNum = int.Parse(param[1]);
     }
     if (param.Length > 2)
     {
         BallInfo.SetInterSP(param[2]);
     }
 }
コード例 #10
0
    public bool ExChangeBall(BallInfo other)
    {
        if (!IsCanExChange(other))
        {
            return(false);
        }

        var temp = other.BallType;

        other.BallType = _BallType;
        _BallType      = temp;

        var tempRound = other.BornRound;

        other.BornRound = BornRound;
        BornRound       = tempRound;

        if (_BallInfoSP != null && _BallInfoSP.IsExchangeSpInfo(other))
        {
            var tempSP = other._BallInfoSP;
            other._BallInfoSP = _BallInfoSP;
            _BallInfoSP       = tempSP;


            var tempSpType = other.BallSPType;
            other.BallSPType = BallSPType;
            BallSPType       = tempSpType;

            if (_BallInfoSP != null)
            {
                _BallInfoSP.SetBallInfo(this);
            }
            other._BallInfoSP.SetBallInfo(other);
        }
        else if (other._BallInfoSP != null && other._BallInfoSP.IsExchangeSpInfo(this))
        {
            var tempSP = other._BallInfoSP;
            other._BallInfoSP = _BallInfoSP;
            _BallInfoSP       = tempSP;
            _BallInfoSP.SetBallInfo(other);

            var tempSpType = other.BallSPType;
            other.BallSPType = BallSPType;
            BallSPType       = tempSpType;

            _BallInfoSP.SetBallInfo(this);
            if (other._BallInfoSP != null)
            {
                other._BallInfoSP.SetBallInfo(other);
            }
        }

        return(true);
    }
コード例 #11
0
        private BallInfo FindNextWay(BallInfo pathWay, BallInfo fromWay)
        {
            foreach (var pathBall in pathWay._Passes)
            {
                if (pathBall != fromWay)
                {
                    return(pathBall);
                }
            }

            return(null);
        }
コード例 #12
0
    public void SendPosition(Vector3 rot, Vector3 pos)
    {
        BallInfo info = new BallInfo();

        info.rotation = rot;
        info.position = pos;
        string jsonString = JsonUtility.ToJson(info);

        //Debug.Log(jsonString);
        Byte[] sendBytes = Encoding.ASCII.GetBytes(jsonString);
        udp.Send(sendBytes, sendBytes.Length);
    }
コード例 #13
0
 public bool IsEquipNormal(BallInfo other)
 {
     if (other == null)
     {
         return(false);
     }
     if (_BallType == BallType.None)
     {
         return(false);
     }
     return(_BallType == other.BallType);
 }
コード例 #14
0
ファイル: Player.cs プロジェクト: uvbs/DDTank-3.0
        public override void Reset()
        {
            m_maxBlood = (int)((950 + m_player.PlayerCharacter.Grade * 50 + LevelPlusBlood + m_player.PlayerCharacter.Defence / 10) * m_player.GetBaseBlood());
            if (m_game.RoomType == eRoomType.Treasure || m_game.RoomType == eRoomType.Boss)
            {
                m_game.Cards = new int[21];
            }
            else
            {
                m_game.Cards = new int[8];
            }

            Dander         = 0;
            m_energy       = (m_player.PlayerCharacter.Agility / 30 + 240);
            IsLiving       = true;
            FinishTakeCard = false;
            m_weapon       = m_player.MainWeapon;
            //m_mainBallId = m_weapon.Property1;
            //m_spBallId = m_weapon.Property2;
            var ballConfig = BallConfigMgr.FindBall(m_weapon.TemplateID);

            m_mainBallId = ballConfig.Common;
            m_spBallId   = ballConfig.Special;
            BaseDamage   = m_player.GetBaseAttack();
            BaseGuard    = m_player.GetBaseDefence();

            Attack  = m_player.PlayerCharacter.Attack;
            Defence = m_player.PlayerCharacter.Defence;
            Agility = m_player.PlayerCharacter.Agility;
            Lucky   = m_player.PlayerCharacter.Luck;

            m_currentBall = BallMgr.FindBall(m_mainBallId);
            m_shootCount  = 1;
            m_ballCount   = 1;

            CurrentIsHitTarget = false;

            TotalCure           = 0;
            TotalHitTargetCount = 0;
            TotalHurt           = 0;
            TotalKill           = 0;
            TotalShootCount     = 0;
            LockDirection       = false;
            GainGP    = 0;
            GainOffer = 0;
            Ready     = false;
            PlayerDetail.ClearTempBag();

            LoadingProcess = 0;

            base.Reset();
        }
コード例 #15
0
ファイル: ProduceBussiness.cs プロジェクト: uvbs/DDTank-3.0
        public BallInfo[] GetAllBall()
        {
            List <BallInfo> infos  = new List <BallInfo>();
            SqlDataReader   reader = null;

            try
            {
                db.GetReader(ref reader, "SP_Ball_All");
                while (reader.Read())
                {
                    BallInfo info = new BallInfo();
                    info.Amount         = (int)reader["Amount"];
                    info.ID             = (int)reader["ID"];
                    info.Name           = reader["Name"].ToString();
                    info.Crater         = reader["Crater"] == null ? "" : reader["Crater"].ToString();
                    info.Power          = (double)reader["Power"];
                    info.Radii          = (int)reader["Radii"];
                    info.AttackResponse = (int)reader["AttackResponse"];
                    info.BombPartical   = reader["BombPartical"].ToString();
                    info.FlyingPartical = reader["FlyingPartical"].ToString();
                    info.IsSpin         = (bool)reader["IsSpin"];
                    info.Mass           = (int)reader["Mass"];
                    info.SpinV          = (int)reader["SpinV"];
                    info.SpinVA         = (double)reader["SpinVA"];
                    info.Wind           = (int)reader["Wind"];
                    info.DragIndex      = (int)reader["DragIndex"];
                    info.Weight         = (int)reader["Weight"];
                    info.Shake          = (bool)reader["Shake"];
                    info.Delay          = (int)reader["Delay"];
                    info.ShootSound     = reader["ShootSound"] == null ? "" : reader["ShootSound"].ToString();
                    info.BombSound      = reader["BombSound"] == null ? "" : reader["BombSound"].ToString();
                    info.ActionType     = (int)reader["ActionType"];
                    info.HasTunnel      = (bool)reader["HasTunnel"];
                    infos.Add(info);
                }
            }
            catch (Exception e)
            {
                if (log.IsErrorEnabled)
                {
                    log.Error("Init", e);
                }
            }
            finally
            {
                if (reader != null && !reader.IsClosed)
                {
                    reader.Close();
                }
            }
            return(infos.ToArray());
        }
コード例 #16
0
    public override string GetExtraSpType(int rawCnt, int clumnCnt, BallInfo optBall)
    {
        if (rawCnt + clumnCnt == 4)
        {
            return((int)BallType.BombSmallLighting + "," + (int)optBall.BallType);
        }
        else
        {
            return((int)BallType.BombBigLighting + "," + (int)optBall.BallType);
        }

        return("");
    }
コード例 #17
0
ファイル: Player.cs プロジェクト: changthai2540/DDTank-II
        public override void Reset()
        {
            this.m_maxBlood = this.m_player.PlayerCharacter.hp;
            if (this.m_game.RoomType == eRoomType.Dungeon)
            {
                this.m_game.Cards = new int[21];
            }
            else
            {
                this.m_game.Cards = new int[9];
            }
            base.Dander         = 0;
            base.PetMP          = 10;
            base.psychic        = 40;
            this.m_energy       = this.m_player.PlayerCharacter.Agility / 30 + 240;
            base.IsLiving       = true;
            this.FinishTakeCard = false;
            this.m_DeputyWeapon = this.m_player.SecondWeapon;
            this.m_weapon       = this.m_player.MainWeapon;
            BallConfigInfo ballConfigInfo = BallConfigMgr.FindBall(this.m_weapon.TemplateID);

            this.m_mainBallId        = ballConfigInfo.Common;
            this.m_spBallId          = ballConfigInfo.Special;
            this.m_sp2BallId         = ballConfigInfo.SpecialII;
            this.m_AddWoundBallId    = ballConfigInfo.CommonAddWound;
            this.m_MultiBallId       = ballConfigInfo.CommonMultiBall;
            this.BaseDamage          = this.m_player.GetBaseAttack();
            this.BaseGuard           = this.m_player.GetBaseDefence();
            this.Attack              = (double)this.m_player.PlayerCharacter.Attack;
            this.Defence             = (double)this.m_player.PlayerCharacter.Defence;
            this.Agility             = (double)this.m_player.PlayerCharacter.Agility;
            this.Lucky               = (double)this.m_player.PlayerCharacter.Luck;
            this.m_currentBall       = BallMgr.FindBall(this.m_mainBallId);
            this.m_shootCount        = 1;
            this.m_ballCount         = 1;
            this.m_prop              = 0;
            this.CurrentIsHitTarget  = false;
            this.TotalCure           = 0;
            this.TotalHitTargetCount = 0;
            this.TotalHurt           = 0;
            this.TotalKill           = 0;
            this.TotalShootCount     = 0;
            this.LockDirection       = false;
            this.GainGP              = 0;
            this.GainOffer           = 0;
            this.Ready               = false;
            this.PlayerDetail.ClearTempBag();
            this.LoadingProcess = 0;
            this.skillcu        = 0;
            base.Reset();
        }
コード例 #18
0
 public SimpleBomb(int id, BombType type, Living owner, BaseGame game, BallInfo info, Tile shape, bool controled) : base(id, (float)info.Mass, (float)info.Weight, (float)info.Wind, (float)info.DragIndex)
 {
     this.m_owner     = owner;
     this.m_game      = game;
     this.m_info      = info;
     this.m_shape     = shape;
     this.m_type      = type;
     this.m_power     = info.Power;
     this.m_radius    = info.Radii;
     this.m_controled = controled;
     this.m_bombed    = false;
     this.m_lifeTime  = 0f;
     this.digMap      = true;
 }
コード例 #19
0
 public virtual void SetBallSPType(BallInfo ballInfo, bool isInner = false)
 {
     if (ballInfo == null)
     {
         _BallSPType = BallType.None;
         return;
     }
     _BallInfo   = ballInfo;
     _BallSPType = ballInfo.BallSPType;
     if (isInner)
     {
         _BallSPType = ballInfo.IncludeBallSPType;
     }
 }
コード例 #20
0
ファイル: Ball.cs プロジェクト: nisokaaa/BokoGames
    /// <summary>
    /// 初期化関数
    /// </summary>
    /// <param name="position">初期位置</param>
    /// <param name="info">ボール情報</param>
    public void Init(Vector2 position, BallInfo info)
    {
        // 一意なID設定
        m_Id = Guid.NewGuid().ToString("N").Substring(0, 5);

        // ボール情報をロード
        m_Info = info;

        // Spriteを設定
        GetComponent <Image>().sprite = m_Info.sprite;

        // 2D座標を設定
        m_Rect.position = position;
    }
コード例 #21
0
    public override void ShowBallInfo(BallInfo ballInfo, bool isInner)
    {
        ClearInfo();
        int spNum   = 0;
        int showNum = 0;

        if (isInner)
        {
            spNum   = ((BallInfoSPTrapBase)ballInfo._IncludeBallInfoSP).ElimitNum;
            showNum = ((BallInfoSPTrapBase)ballInfo._IncludeBallInfoSP).ShowNum;
        }
        else
        {
            spNum   = ((BallInfoSPTrapBase)ballInfo._BallInfoSP).ElimitNum;
            showNum = ((BallInfoSPTrapBase)ballInfo._BallInfoSP).ShowNum;
        }
        int showIdx = 0;

        _SPNum.text = "";
        if (spNum > _SPBallFrozen.Length)
        {
            showIdx = _SPBallFrozen.Length - 1;
            _SPNum.gameObject.SetActive(true);
        }
        else
        {
            showIdx = spNum - 1;
            _SPNum.gameObject.SetActive(false);
        }

        if (showNum < spNum)
        {
            Debug.Log("PlayAnim " + ballInfo.Pos + " showNum:" + showNum);
            StartCoroutine(AppearAnim(showIdx, spNum));

            if (isInner)
            {
                ((BallInfoSPTrapBase)ballInfo._IncludeBallInfoSP).ShowNum = spNum;
            }
            else
            {
                ((BallInfoSPTrapBase)ballInfo._BallInfoSP).ShowNum = spNum;
            }
        }
        else
        {
            SetBallInfo(showIdx, spNum);
        }
    }
コード例 #22
0
        private static bool LoadBall(Dictionary <int, BallInfo> balls, Dictionary <int, Tile> ballTile)
        {
            using (ProduceBussiness db = new ProduceBussiness())
            {
                BallInfo[] ballInfos = db.GetAllBall();
                foreach (BallInfo b in ballInfos)
                {
                    if (!balls.ContainsKey(b.ID))
                    {
                        balls.Add(b.ID, b);

                        Tile   shape = null;
                        string file  = string.Format("bomb\\{0}.bomb", b.ID);
                        if (File.Exists(file))
                        {
                            shape = new Tile(file, false);
                        }

                        if (shape != null)
                        {
                            ballTile.Add(b.ID, shape);
                        }
                        else
                        {
                            if (b.ID != 1 && b.ID != 2 && b.ID != 3)
                            {
                                if (log.IsErrorEnabled)
                                {
                                    log.Error("Ball's file is not exist!");
                                }
                                return(false);
                            }
                        }
                    }
                }
            }

            if (!balls.ContainsKey(0))
            {
                BallInfo temp = new BallInfo();
                temp.ID     = 0;
                temp.Power  = 1;
                temp.Radii  = 60;
                temp.Amount = 1;
                balls.Add(0, temp);
            }

            return(true);
        }
コード例 #23
0
ファイル: SimpleBomb.cs プロジェクト: uvbs/DDTank-3.0
        public SimpleBomb(int id, BombType type, Player owner, BaseGame game, BallInfo info, Tile shape, bool controled)
            : base(id, info.Mass, info.Weight, info.Wind, info.DragIndex)
        {
            m_owner = owner;
            m_game  = game;
            m_info  = info;

            m_shape     = shape;
            m_type      = type;
            m_power     = info.Power;
            m_radius    = info.Radii;
            m_controled = controled;

            m_lifeTime = 0;
        }
コード例 #24
0
ファイル: Player.cs プロジェクト: changthai2540/DDTank-II
 public void SetBall(int ballId, bool special)
 {
     if (ballId != this.m_currentBall.ID)
     {
         if (BallMgr.FindBall(ballId) != null)
         {
             this.m_currentBall = BallMgr.FindBall(ballId);
         }
         this.BallCount = this.m_currentBall.Amount;
         if (!special || ballId == 4)
         {
             this.ShootCount = 1;
         }
         this.m_game.SendGameUpdateBall(this, special);
     }
 }
コード例 #25
0
ファイル: SettingsLoader.cs プロジェクト: JeF0X/golf-league
 private void FindPlayerInfo()
 {
     for (int playerIndex = 0; playerIndex < playerInfoGameobject.Length; playerIndex++)
     {
         string          name       = playerInfoGameobject[playerIndex].GetComponentInChildren <TMP_InputField>().text;
         Color           color      = playerInfoGameobject[playerIndex].GetComponentInChildren <TMP_InputField>().colors.normalColor;
         BallInfo        ballInfo   = defaultBallInfo;
         int             ballAmount = 1;
         List <BallInfo> balls      = new List <BallInfo>();
         for (int ballIndex = 0; ballIndex < ballAmount; ballIndex++)
         {
             balls.Add(defaultBallInfo);
         }
         playerInfos.Add(new PlayerInfo(name, color, balls));
     }
 }
コード例 #26
0
    public override string GetExtraSpType(int rawCnt, int clumnCnt, BallInfo optBall)
    {
        if (rawCnt + clumnCnt > 4)
        {
            return((int)BallType.LineCrossReact + "," + (int)optBall.BallType);
        }
        else if (rawCnt == 4)
        {
            return((int)BallType.LineRowReact + "," + (int)optBall.BallType);
        }
        else if (clumnCnt == 4)
        {
            return((int)BallType.LineClumnReact + "," + (int)optBall.BallType);
        }

        return("");
    }
コード例 #27
0
    protected bool IsPosBlock(BallInfo ballInfo)
    {
        if (ballInfo == null)
        {
            return(false);
        }

        if (ballInfo.BallSPType == BallType.Clod ||
            ballInfo.BallSPType == BallType.Ice ||
            ballInfo.BallSPType == BallType.Iron ||
            ballInfo.BallSPType == BallType.Stone)
        {
            return(true);
        }

        return(false);
    }
コード例 #28
0
ファイル: BallCreator.cs プロジェクト: arahis/Balls
    public void FixedUpdate()
    {
        if (CreateAllNextFrame != null)
        {
            foreach (var ball in CreateAllNextFrame)
            {
                ResourceManager.CreatedBalls.Add(SetBall(ball));
            }
            CreateAllNextFrame.Clear();
        }

        if (CreateNextFrame != null)
        {
            ResourceManager.CreatedBalls.Add(GenerateBall(CreateNextFrame));
            CreateNextFrame = null;
        }
    }
コード例 #29
0
ファイル: BallExtensions.cs プロジェクト: Turnerj/RocketBot
        public static void Update(this Ball ball, BallInfo partial)
        {
            if (partial.Physics.HasValue)
            {
                ball.Physics.Update(partial.Physics.Value);
            }

            if (partial.LatestTouch.HasValue)
            {
                if (ball.LatestTouch == null)
                {
                    ball.LatestTouch = new BallTouch();
                }

                ball.LatestTouch.Update(partial.LatestTouch.Value);
            }
        }
コード例 #30
0
ファイル: Ball.cs プロジェクト: kdm1jkm/PenguinGameClone
        public Ball(BallInfo info)
        {
            _info  = info;
            _shape = new CircleShape
            {
                OutlineColor = Color.Black,
                Radius       = RADIUS,
                Origin       = new Vector2f(RADIUS, RADIUS),
                FillColor    = _info.BasicColor
            };
            Selected    = false;
            CurrentTeam = info.Team;

            Arrow = new Arrow(Arrow.ArrowInfo.BASIC)
            {
                Delta = new Vector2f(.0f, .0f)
            };
        }
コード例 #31
0
ファイル: Player.cs プロジェクト: SkelletonX/DDTServer
 public override void Reset()
 {
     this.m_maxBlood         = (int)((double)(950 + this.m_player.PlayerCharacter.Grade * 50 + this.LevelPlusBlood + this.m_player.PlayerCharacter.Defence / 10) * this.m_player.GetBaseBlood());
     this.HasPaymentTakeCard = false;
     base.Dander             = 0;
     this.m_energy           = this.m_player.PlayerCharacter.Agility / 30 + 240;
     this.m_ghostEnergy      = this.m_energy;
     base.IsLiving           = true;
     this.FinishTakeCard     = false;
     this.m_weapon           = this.m_player.MainWeapon;
     this.m_mainBallId       = this.m_weapon.Property1;
     this.m_spBallId         = this.m_weapon.Property2;
     this.BaseDamage         = this.m_player.GetBaseAttack();
     this.BaseGuard          = this.m_player.GetBaseDefence();
     this.Attack             = (double)this.m_player.PlayerCharacter.Attack;
     this.Defence            = (double)this.m_player.PlayerCharacter.Defence;
     this.Agility            = (double)this.m_player.PlayerCharacter.Agility;
     this.Lucky = (double)this.m_player.PlayerCharacter.Luck;
     this.InitBuffer(this.m_player.EquipEffect);
     this.m_currentBall           = BallMgr.FindBall(this.m_mainBallId);
     this.m_shootCount            = 1;
     this.m_ballCount             = 1;
     this.CurrentIsHitTarget      = false;
     this.m_killedPunishmentOffer = 0;
     this.TotalCure           = 0;
     this.TotalHitTargetCount = 0;
     this.TotalHurt           = 0;
     this.TotalKill           = 0;
     this.TotalShootCount     = 0;
     this.LockDirection       = false;
     this.GainGP    = 0;
     this.GainOffer = 0;
     this.Ready     = false;
     this.PlayerDetail.ClearTempBag();
     this.m_delay        = this.GetInitDelay();
     this.TargetPoint    = Point.Empty;
     this.m_flyCoolDown  = 0;
     this.m_secondWeapon = 0;
     if (this.PlayerDetail.SecondWeapon != null)
     {
         this.AngelCount = this.PlayerDetail.SecondWeapon.StrengthenLevel + 1;
     }
     base.Reset();
 }
コード例 #32
0
ファイル: Living.cs プロジェクト: uvbs/DDTank-3.0
        public void GetShootForceAndAngle(ref int x, ref int y, int bombId, int minTime, int maxTime, int bombCount, float time, ref int force, ref int angle)
        {
            if (minTime >= maxTime)
            {
                return;
            }

            BallInfo ballInfo = BallMgr.FindBall(bombId);

            if (m_game != null && ballInfo != null)
            {
                Map   map  = m_game.Map;
                Point sp   = GetShootPoint();
                float dx   = x - sp.X;
                float dy   = y - sp.Y;
                float arf  = map.airResistance * ballInfo.DragIndex;
                float gf   = map.gravity * ballInfo.Weight * ballInfo.Mass;
                float wf   = map.wind * ballInfo.Wind;
                float mass = ballInfo.Mass;
                for (float t = time; t <= 4; t += 0.6F)
                {
                    double vx = ComputeVx(dx, mass, arf, wf, t);
                    double vy = ComputeVy(dy, mass, arf, gf, t);

                    if (vy < 0 && vx * m_direction > 0)
                    {
                        double tf = Math.Sqrt(vx * vx + vy * vy);
                        if (tf < 2000)
                        {
                            //Console.WriteLine(string.Format("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< vx:{0}   vy:{1}", vx, vy));
                            force = (int)tf;
                            angle = (int)(Math.Atan(vy / vx) / Math.PI * 180);
                            if (vx < 0)
                            {
                                angle = angle + 180;
                            }
                            break;
                        }
                    }
                }
                x = sp.X;
                y = sp.Y;
            }
        }
コード例 #33
0
ファイル: BallCreator.cs プロジェクト: arahis/Balls
    public BallController GenerateBall(BallInfo info)
    {
        Debug.Log("Generate ball()");

        GameObject ball = Instantiate(ResourceManager.Ball);

        ball.transform.SetParent(GameController.Instance.GameRoot.transform);
        ball.transform.localScale = new Vector3(info.Size, info.Size, info.Size);

        ball.transform.localPosition = info.SpawnPosition;

        var controller = ball.GetComponent<BallController>();
        controller.Size = info.Size;
        controller.Index = info.Index;
        controller.SpawnPosition = info.SpawnPosition;

        var mesh = ball.GetComponent<MeshRenderer>();
        mesh.material = ResourceManager.Material;
        mesh.material.mainTexture = TexturesManager.GetRandomTexture(info.Size);

        return controller;
    }
コード例 #34
0
ファイル: BallFactory.cs プロジェクト: jarena3/Ool
    public void Instantiate(BallInfo ballInfo, int ballnumber)
    {
        var ball = (GameObject) PrefabUtility.InstantiatePrefab(BallPrefab);
        var pos = new Vector3(ballInfo.positionX, ballInfo.positionY, ballInfo.positionZ);
        var b = ball.GetComponent<Ball>();
        ball.transform.position = pos;

        ball.transform.SetParent(TablePivot);

        ball.GetComponent<SphereCollider>().material = Manager.BallPhysicMaterial;
        if (ballInfo.isBogus)
        {
            b.IsBogus = true;
            ball.GetComponent<MeshRenderer>().material = BogusMaterial;
        }
        else
        {
            b.SetNumber(ballnumber);
            ball.GetComponent<MeshRenderer>().material = Manager.BallMaterial;

            var textureNumber = ballnumber;
            while (textureNumber > 15) textureNumber -= 15;

            var renderer = ball.GetComponent<Renderer>();
            var mat = renderer.material;
            mat.EnableKeyword("_DETAIL_MULX2");
            mat.SetTexture("_DetailAlbedoMap", BallNumberTextures[textureNumber - 1]);

            renderer.material = mat;

            if (b.ballNumber == 1)
            {
                b.SetBallAsTarget();
            }

        }
    }
コード例 #35
0
ファイル: BallCreator.cs プロジェクト: arahis/Balls
 public void Start()
 {
     if (Instance == null)
     {
         Instance = this;
     }
     else
     {
         Destroy(gameObject);
         return;
     }
     CreateNextFrame = null;
 }
コード例 #36
0
ファイル: paddleAI.cs プロジェクト: jeremymwat/homework
 // Use this for initialization
 void Start()
 {
     ballInfo = sphere.GetComponent<BallInfo>();
     masterController = masterGameController.GetComponent<MasterController>();
 }
コード例 #37
0
ファイル: NetworkMessage.cs プロジェクト: arahis/Balls
 public CreateBallMessage(BallInfo ball)
 {
     MessageType = NetworkMessageType.CreateBall;
     Ball = ball;
 }