Inheritance: MonoBehaviour
 // Use this for initialization
 void Start()
 {
     m_PlayerStats = GetComponent <PlayerStats>();
     m_Controls    = GetComponent <Controls>();
     m_Boost       = GetComponent <PlayerBoost>();
     //m_Animator = GetComponentInChildren<Animator>();
 }
示例#2
0
    protected virtual void OnCollisionEnter2D(Collision2D other)
    {
        if (other.gameObject.tag == "Player")
        {
            // for now, just using zero to not make calculations
            other.gameObject.GetComponent <PlayerBouncer>()?.Bounce(Vector3.zero);

            // if already touched, don't want to count as new platform touched or increase boost meter
            if (!touched)
            {
                PlayerBoost playerBoost = other.gameObject.GetComponent <PlayerBoost>();
                if (playerBoost != null)
                {
                    playerBoost.BoostMeter += boostValue;
                }

                UpdateEOTouched(pointValue);
                touched = true;

                PingFeedback(true);
            }
            else
            {
                PingFeedback();
            }
        }
    }
 // Use this for initialization
 void Start()
 {
     playerBoost = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerBoost>();
     if (playerBoost == null)
     {
         Debug.LogError("Cannot find boost controller");
     }
 }
示例#4
0
 /// <summary>
 /// 初期化処理
 /// </summary>
 void Start()
 {
     // コンポーネントの取得
     playerBoost       = GetComponent <PlayerBoost>();
     playerSlide       = GetComponent <PlayerSlide>();
     playerAerialState = GetComponent <AerialState>();
     playerAttack      = GetComponent <PlayerAttack>();
     character         = GetComponent <Player>();
 }
示例#5
0
    private void Awake()
    {
        if (instance != null)
        {
            Debug.LogWarning("il y a plus d'une instance de Inventory dans la scéne");
            return;
        }

        instance = this;
    }
    void Awake()
    {
        instance = this;

        matchTimerLength = DMMatchSettings.instance.GetMatchTimer();
        matchTimer       = matchTimerLength;

        int curSpawnPoint = 0;

        for (int i = 0; i < DMMatchSettings.instance.GetNumberOfPlayers(); i++)
        {
            Vector2    spawnPos  = initialSpawnContainer.GetChild(curSpawnPoint).position;
            PlayerData newPlayer = Instantiate(playerPrefab, spawnPos, Quaternion.identity).GetComponent <PlayerData>();
            newPlayer.SetPlayerNum(i + 1);

            //Apply player health setting
            newPlayer.maxHealth = DMMatchSettings.instance.GetPlayerHealth();

            //Apply bouncy players setting
            Rigidbody2D       playerRB = newPlayer.GetComponent <Rigidbody2D>();
            PhysicsMaterial2D newMat   = new PhysicsMaterial2D();
            newMat.friction         = 0;
            newMat.bounciness       = (DMMatchSettings.instance.GetBouncyPlayers()) ? 1 : 0;
            playerRB.sharedMaterial = newMat;

            //Apply speed multiplier setting
            PlayerBoost playerBoost = newPlayer.GetComponent <PlayerBoost>();
            playerBoost.boostPower *= DMMatchSettings.instance.GetSpeedMultiplier();

            //Apply drag multiplier setting
            playerRB.drag *= DMMatchSettings.instance.GetDragMultiplier();

            //Apply size multiplier setting
            newPlayer.transform.localScale *= DMMatchSettings.instance.GetSizeMultiplier();

            //Apply knockback multiplier setting
            PlayerMovement playerMovement = newPlayer.GetComponent <PlayerMovement>();
            playerMovement.SetKnockbackMultiplier(DMMatchSettings.instance.GetKnockbackMultiplier());

            //Add the player to the cinemachine
            cmTargetGroup.AddMember(newPlayer.transform, 1, 0);

            curSpawnPoint++;
            if (curSpawnPoint >= initialSpawnContainer.childCount)
            {
                curSpawnPoint = 0;
            }
        }

        DMMatchStats.instance.SetupPlayerStats();
    }
示例#7
0
    // Start is called before the first frame update
    void Start()
    {
        // コンポーネントの取得
        player       = GetComponent <Player>();
        playerAttack = GetComponent <PlayerAttack>();
        playerBoost  = GetComponent <PlayerBoost>();
        // チャージ状態を表すゲージオブジェクト
        var chargeGauge = transform.Find("ChargeGauge").gameObject;

        // ゲージのオブジェクトからのアニメーターコンポーネントの取得
        this.chargeGauge = chargeGauge.GetComponent <ChargeGauge>();
        // パラメータをセット
        ReadTextParameter();
    }
示例#8
0
        public override void Show()
        {
            if (!this.gameObject.activeInHierarchy)
            {
                base.Show();
                //play slide in animation
                StartCoroutine("SlideIn");
            }

            // disalbe player from activating equipped ability
            PlayerBoost playerBooster = GameMaster.Instance.m_PlayerBoost;

            playerBooster.Reset();             /* call this first to reset so that if the booster is cooling down
                                                * it wont re-allow a player to press on it while in the warpstore to activate it.*/
            playerBooster.canActivate = false; // then don't let player activate the booster in warp store.
        }
示例#9
0
    private void Start()
    {
        GroundCheck      = GetComponent <GroundCheck>();
        PlayerThrust     = GetComponent <PlayerThrust>();
        PlayerTurn       = GetComponent <PlayerTurn>();
        PlayerCarve      = GetComponent <PlayerCarve>();
        PlayerFriction   = GetComponent <PlayerGroundFriction>();
        PlayerDash       = GetComponent <PlayerDash>();
        PlayerBoost      = GetComponent <PlayerBoost>();
        PlayerJump       = GetComponent <PlayerJump>();
        PlayerAirControl = GetComponent <PlayerAirControl>();
        QuadraticDrag    = GetComponent <QuadraticDrag>();
        CenterOfMass     = GetComponent <CustomCenterOfMass>();
        RB     = GetComponent <Rigidbody>();
        Combat = GetComponent <CombatController>();

        CanCarve = true;
    }
示例#10
0
    void OnTriggerEnter(Collider col)
    {
        if (col.gameObject.name == "RedBall")
        {
            BallMovement other = (BallMovement)GameObject.Find("RedBall").GetComponent(typeof(BallMovement));
            other.boost = 100;
            PlayerBoost pb = (PlayerBoost)GameObject.Find("RedBoostBar").GetComponent(typeof(PlayerBoost));
            pb.fillBar();
            Vector3 pos = new Vector3(Random.Range(-40f, 40f), 58, Random.Range(-30f, 80f));
        }
        if (col.gameObject.name == "BlueBall")
        {
            BallMovement other = (BallMovement)GameObject.Find("BlueBall").GetComponent(typeof(BallMovement));
            other.boost = 100;
            PlayerBoost pb = (PlayerBoost)GameObject.Find("BlueBoostBar").GetComponent(typeof(PlayerBoost));
            pb.fillBar();
        }

        this.gameObject.SetActive(false);
        GameObject.Find("Canvas").GetComponent <PowerUpManager>().spawned--;
    }
示例#11
0
    protected void Awake()
    {
        if (!networkView.isMine)
        {
            enabled = false;
        }

        if (string.IsNullOrEmpty(PlayerOptions.playerID))
        {
            id = "Jane Doe";
        }
        else
        {
            id = PlayerOptions.playerID;
        }

        boostController    = GetComponent <PlayerBoost>();
        weaponController   = GetComponent <PlayerWeapons>();
        healthController   = GetComponent <PlayerHP>();
        movementController = GetComponent <PlayerMovement>();
        maxHealth          = healthController.GetMaxHP();
    }
示例#12
0
    public void Init()
    {
        m_playerBoost      = (PlayerBoost)GetComponent(typeof(PlayerBoost));
        m_playerTilt       = (PlayerTilt)GetComponent(typeof(PlayerTilt));
        m_playerRoll       = (PlayerRoll)GetComponent(typeof(PlayerRoll));
        m_playerRetroBoost = (PlayerRetroBoost)GetComponent(typeof(PlayerRetroBoost));
        m_playerCollision  = (PlayerCollision)GetComponent(typeof(PlayerCollision));

        m_playerBoost.Init();
        m_playerTilt.Init();
        m_playerRoll.Init();
        m_playerRetroBoost.Init();

        m_currentOffset = new Vector3(0.5f, 0.5f, 0f);
        m_targetOffset  = m_currentOffset;
        m_offsetDelta   = Vector3.zero;
        m_prevOffset    = Vector3.zero;

        m_targetSpeed  = m_normalSpeed;
        m_currentSpeed = 0f;

        m_targetRot = Vector3.forward;

        SegmentManager.Init();

        m_pathPosition     = SegmentManager.instance.GetNextPosition(0f);
        transform.position = m_pathPosition;

        transform.rotation = Quaternion.identity;

        if (!m_camera)
        {
            m_camera = (ChaseCamera)GameObject.FindObjectOfType(typeof(ChaseCamera));
        }

        m_camera.Init(this);

        m_camera.UpdateCamera();
    }
示例#13
0
        void Awake()
        {
            // create static instance if there is not one
            if (Instance == null)
            {
                Instance = this;
            }
            else
            {
                if (Instance != this)
                {
                    Destroy(this.gameObject);
                }
            }

            if (m_MusicManager == null)
            {
                m_MusicManager = FindObjectOfType <MusicManager>();
            }
            if (m_NotificationManager == null)
            {
                m_NotificationManager = FindObjectOfType <NotificationManager>();
            }
            if (m_PlayerDecorations == null)
            {
                m_PlayerDecorations = FindObjectOfType <PlayerDecorations>();
            }
            if (m_DatabaseManager == null)
            {
                m_DatabaseManager = FindObjectOfType <DatabaseManager>();
            }
            if (m_PlayerMovement == null)
            {
                m_PlayerMovement = FindObjectOfType <PlayerMovement>();
            }
            if (m_UIManager == null)
            {
                m_UIManager = FindObjectOfType <UIManager>();
            }
            if (m_DeathStar == null)
            {
                m_DeathStar = FindObjectOfType <DeathStar>();
            }
            if (m_CameraFollow == null)
            {
                m_CameraFollow = FindObjectOfType <CameraFollow>();
            }
            if (m_WarpZoneManager == null)
            {
                m_WarpZoneManager = FindObjectOfType <WarpZoneManager>();
            }
            if (m_BackDropManager == null)
            {
                m_BackDropManager = FindObjectOfType <BackdropManager>();
            }
            if (m_StatsManager == null)
            {
                m_StatsManager = FindObjectOfType <StatsManager>();
            }
            if (m_PlayerStats == null)
            {
                m_PlayerStats = FindObjectOfType <PlayerStats>();
            }
            if (m_DadEventManager == null)
            {
                m_DadEventManager = FindObjectOfType <DadEventManager>();
            }
            if (m_PlayerBoost == null)
            {
                m_PlayerBoost = FindObjectOfType <PlayerBoost>();
            }
            if (m_SolarSystemSpawner == null)
            {
                m_SolarSystemSpawner = FindObjectOfType <SolarSystemSpawner>();
            }
            if (m_StreakManager == null)
            {
                m_StreakManager = FindObjectOfType <StreakManager>();
            }
        }
示例#14
0
 /// <summary>
 /// Add the specified boost to the bonus list.
 /// </summary>
 /// <param name="b">The bonus.</param>
 public void Add(PlayerBoost b)
 {
     this.bonuses.Add(b);
 }
示例#15
0
文件: Game.cs 项目: jcolag/BaseDice
        /// <summary>
        /// Takes the turn.
        /// </summary>
        /// <returns>>A report of the at-bat results.</returns>
        /// <param name="bonus">Bonus the player would like to use.</param>
        public string TakeTurn(PlayerBoost bonus)
        {
            int rollTotal = 0;
                        int oldHits = this.player.Hits;
                        int curr = this.player.CurrentInning(Game.Inning);
                        string report = string.Empty;
                        string nl = Environment.NewLine;
                        bool inning = false;

                        this.sound = string.Empty;
                        this.roll = this.Roll();
                        foreach (int val in this.roll)
                        {
                                rollTotal += val;
                        }

                        if (this.player.Point == 0)
                        {
                                report = this.TurnNoPoint(this.roll);
                                if (rollTotal == 12)
                                {
                                        report += " (Crapped out, bets pushed) ";
                                }
                                else if (new List<int>() { 2, 3 }.Contains(rollTotal))
                                {
                                        report += " (Crapped out) ";
                                }
                                else if (new List<int>() { 7, 11 }.Contains(rollTotal))
                                {
                                        report += " (Natural) ";
                                }
                                else
                                {
                                        this.player.SetPoint(rollTotal);
                                        report = "the point is " + this.player.Point.ToString() + ", " + report;
                                        report += " (On) ";
                                }
                        }
                        else
                        {
                                if (rollTotal == this.player.Point)
                                {
                                        report = this.TurnPointMatched(this.roll);
                                        report += " (Hit the point) ";
                                        this.player.UnsetPoint();
                                }
                                else if (rollTotal == 7)
                                {
                                        report += " (Seven-out) ";
                                        this.player.UnsetPoint();
                                }

                                string report2 = this.TurnWithPoint(this.roll);
                                if (!string.IsNullOrWhiteSpace(report) && !string.IsNullOrWhiteSpace(report2))
                                {
                                        report += nl + report2;
                                }
                                else if (!string.IsNullOrWhiteSpace(report2))
                                {
                                        report = report2;
                                }
                        }

                        string runners = this.player.ReportRuns(nl);

                        if (this.player.IsNewInning(Game.Inning))
                        {
                                int which = this.player.CurrentInning(Game.Inning) - 1;
                                report += nl + " * " + which.ToString();
                                report += Ordinal(which);

                                report += " inning over! *";
                                inning = true;
                                this.field.Clear();
                        }

                        if (!inning)
                        {
                                switch (bonus)
                                {
                                case PlayerBoost.Walk:
                                        if (oldHits == this.player.Hits)
                                        {
                                                this.field.AddRunner();
                                                report += nl + "Batter walks." + nl;
                                        }

                                        break;
                                case PlayerBoost.StealBase:
                                        // Advance the furthest runner along.
                                        int whichBase = this.field.Steal();
                                        if (whichBase > 0)
                                        {
                                                report += nl + "Runner on " + whichBase.ToString() +
                                                        Ordinal(whichBase) + " steals " +
                                                        this.field.Name(whichBase) + "!" + nl;
                                        }

                                        break;
                                case PlayerBoost.Nothing:
                                        // Do nothing
                                        break;
                                default:
                                        throw new ArgumentOutOfRangeException(
                                                "bonus",
                                                "Impossible bonus passed");
                                }
                        }

                        this.player.AddInning(curr);
                        return runners +
                                "Rolled " + DiceTalk(rollTotal, this.roll[0] == this.roll[1]) + ", " + report;
        }
示例#16
0
 protected void Start()
 {
     Screen.lockCursor = true;
     boostController   = GetComponent <PlayerBoost>();
 }
示例#17
0
 /// <summary>
 /// Remove the specified bonus.
 /// </summary>
 /// <returns>True on success.</returns>
 /// <param name="b">The bonus.</param>
 public bool Remove(PlayerBoost b)
 {
     return this.bonuses.Remove(b);
 }
 // Use this for initialization
 void Start()
 {
     playerBoost = GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerBoost>();
     if(playerBoost == null)
         Debug.LogError("Cannot find boost controller");
 }
 protected void Start()
 {
     Screen.lockCursor = true;
     boostController = GetComponent<PlayerBoost>();
 }
示例#20
0
 public void TriggerEnter(GameObject caller)
 {
     _hasContact     = true;
     _playerHandling = caller.GetComponentInParent <PlayerHandling>();
     _playerBoost    = caller.GetComponentInParent <PlayerBoost>();
 }
示例#21
0
    protected void Awake()
    {
        if( !networkView.isMine ) {
            enabled = false;
        }

        if( string.IsNullOrEmpty(PlayerOptions.playerID) ) {
            id = "Jane Doe";
        } else {
            id = PlayerOptions.playerID;
        }

        boostController = GetComponent<PlayerBoost>();
        weaponController = GetComponent<PlayerWeapons>();
        healthController = GetComponent<PlayerHP>();
        movementController = GetComponent<PlayerMovement>();
        maxHealth = healthController.GetMaxHP();
    }