コード例 #1
0
ファイル: TimerSwitch.cs プロジェクト: letsrefreshus/Ropey
 //Overrides
 public override void onTriggerEnter(PlayerStats stats, ControllerGame controllerGame)
 {
     if (!_ticking || (_ticking && resetOnRetrigger == true))
     {
         animator.SetTrigger("StartTicking");
     }
 }
コード例 #2
0
    //Attempts to get the GameController if no game controller is assigned.
    public void BuildExits()
    {
        exitPointsRemaining = exitPoints;
        if (gameController == null)
        {
            gameController = ControllerGame.GetGameController;
        }

        //Setting Random Level Exit Location
        if (exitPoints.Length > 0)
        {
            switch (ControllerGame.CurrentDifficulty)
            {
            case ControllerGame.Difficulty.VeryEasy:
            case ControllerGame.Difficulty.Easy:
                ActivateAll();
                break;

            case ControllerGame.Difficulty.Medium:
                ActivateSome();
                break;

            case ControllerGame.Difficulty.Hard:
            case ControllerGame.Difficulty.Impossible:
                ActivateOne();
                break;
            }
        }
        //If the array of exits is empty a generic exit is opened.
        else
        {
            exitPoint = gameObject;
        }
    }
コード例 #3
0
    //Update Functions
    #region
    //UpdateDeathCheck
    //Checks to see if the player should be dead.
    private void UpdateDeathCheck()
    {
        PlayerHealth = health;

        if ((health <= 0) && (isInvulnerable != true))
        {
            isDead = true;
        }

        //Only updates the ControllerGame if it needs to.
        //Then sets the player sprite to invisible and turns off its colliders so that game objects do not keep interacting
        //with the invisible, dead player. Then plays the death event.
        if ((isDead) && (ControllerGame.IsPlayerDead != true))
        {
            ControllerGame.PlayerDead(isDead);
            sprite.enabled = false;
            GetComponent <CapsuleCollider2D>().enabled = false;
            GetComponent <PolygonCollider2D>().enabled = false;
            if (deathEmission != null)
            {
                Instantiate(deathEmission, transform.position, transform.rotation);
            }
        }
        //Seperately makes sure that the player's velocity does not increase above zero while dead.
        if (isDead)
        {
            body2D.velocity = Vector2.zero;
        }
    }
コード例 #4
0
ファイル: TriggerSwitch.cs プロジェクト: letsrefreshus/Ropey
 //Overrides
 public override void onTriggerEnter(PlayerStats stats, ControllerGame controllerGame)
 {
     foreach (GameObject target in targets)
     {
         target.SetActive(setActiveTo);
     }
 }
コード例 #5
0
ファイル: PointPickup.cs プロジェクト: letsrefreshus/Ropey
 public override void onTriggerEnter(PlayerStats stats, ControllerGame controllerGame)
 {
     stats.addScore(value);
     if(destroyOnPickup == true)
     {
         Destroy(gameObject);
     }
 }
コード例 #6
0
ファイル: ToggleSwitch.cs プロジェクト: letsrefreshus/Ropey
 //Overrides
 public override void onTriggerEnter(PlayerStats stats, ControllerGame controllerGame)
 {
     _isOn = !_isOn;
     foreach (GameObject target in targets)
     {
         target.SetActive(!target.activeSelf);
         updateSprite();
     }
 }
コード例 #7
0
ファイル: SpeedLimitZone.cs プロジェクト: letsrefreshus/Ropey
 public override void onTriggerStay(PlayerStats stats, ControllerGame controllerGame)
 {
     Vector2 velocity = stats.gameObject.GetComponent<Rigidbody2D>().velocity;
     if(velocity.magnitude > maxSpeed)
     {
         velocity.Normalize();
         velocity *= maxSpeed;
         stats.gameObject.GetComponent<Rigidbody2D>().velocity = velocity;
     }
 }
コード例 #8
0
    //If this is the first and only controller, the following runtime assignments are made.
    void OnEnable()
    {
        CurrentDifficulty = difficulty;

        GetGameController = this.gameObject.GetComponent <ControllerGame> ();

        ControllerUI.InitializeUI(uiMainMenu, uiLevel, uiPause, uiDeath, uiVictory);

        SceneManager.sceneLoaded += OnSceneLoaded;

        InitializeAudio();
    }
コード例 #9
0
ファイル: VortexZone.cs プロジェクト: letsrefreshus/Ropey
    public override void onTriggerStay(PlayerStats stats, ControllerGame controllerGame)
    {
        Vector3 dPosition = gameObject.transform.localPosition - controllerGame.getPlayerPosition();

        float forceToApply = forceAtCenter * (Mathf.Pow(0.5f, dPosition.magnitude / forceHalflife));
        //Debug.Log("Force to apply : " + forceToApply);

        dPosition.Normalize();
        dPosition *= forceToApply;

        controllerGame.applyForceToPlayer(dPosition);
    }
コード例 #10
0
        // Definition of class methods.
        #region Methods

        /// <summary>
        /// Constructor method of the <c>FormGame</c> class.
        /// </summary>
        /// <param name="pokemonPlayer1">List of pokemon chosen by player one.</param>
        /// <param name="pokemonPlayer2">List of pokemon chosen by player two.</param>
        public FormGame(List <Pokemon> pokemonPlayer1, List <Pokemon> pokemonPlayer2)
        {
            InitializeComponent();

            this.FormBorderStyle = FormBorderStyle.FixedSingle;
            this.MaximizeBox     = false;

            labelMessage.Text = "";

            _game = new ControllerGame(pokemonPlayer1, pokemonPlayer2);

            _game.Start();

            Change_round();
        }
コード例 #11
0
    //Runtime Initializations
    //Largely based on specific missile conditionals.
    private void OnEnable()
    {
        //Getting the location of the targety point.
        //Note, this is not a seeking missile, it merely fires toward the target point, it does not update the target after firing.
        GetTargetLocation();

        //Setting velocity
        GetComponent <Rigidbody2D>().velocity = SeekingUtilities.CalculateVelocity(gameObject, targetLocation, speed);

        //Setting destruction after missileLifespan seconds
        Destroy(gameObject, missileLifespan);

        //Setting damage to player damage if usePlayerDamage is true
        if (usePlayerDamage == true)
        {
            effectAmount = ControllerPlayer.PlayerDamage / ControllerGame.DifficultySetting();
        }
    }
コード例 #12
0
ファイル: DrawGiz.cs プロジェクト: Daniel2218/TeamRocket
	void Start () {
        blockTypes[0] = block_normal;
        blockTypes[1] = block_edge;
        blockTypes[2] = block_twist;
		blockTypes[3] = block_stairs;
        typeNum = blockTypes.Length;

        cursor = (GameObject)Instantiate(blockTypes[cursorIndex % typeNum], Vector3.zero, new Quaternion(0,0,0,0));
        cursMat = new Material(cursor.GetComponent<Renderer>().sharedMaterial);  //Save the material set in the inspector for the cursor;
        cursMat.color = new Color(0.0f, 0.4f, 0.4f, 0.1f); //Shake my head
         //Set cursor to block_normal;
		ChangeBlock();
        
        cam = Camera.main;
		controllerGame = cam.GetComponent<ControllerGame>();

		grid[width/2, width/2, width/2] = controllerGame.start_block;
	}
コード例 #13
0
ファイル: OneTimeSwitch.cs プロジェクト: letsrefreshus/Ropey
 //Overrides
 public override void onTriggerEnter(PlayerStats stats, ControllerGame controllerGame)
 {
     if (_triggered == false)
     {
         foreach (GameObject target in targets)
         {
             target.SetActive(setActiveTo);
         }
         if (afterActivatedSprite != null)
         {
             gameObject.GetComponent<SpriteRenderer>().sprite = afterActivatedSprite;
         }
         else
         {
             Destroy(gameObject);
         }
         _triggered = true;
     }
 }
コード例 #14
0
ファイル: WindZone.cs プロジェクト: letsrefreshus/Ropey
 public override void onTriggerStay(PlayerStats stats, ControllerGame controllerGame)
 {
     controllerGame.applyForceToPlayer(_force);
 }
コード例 #15
0
 // Start is called before the first frame update
 void Start()
 {
     controller          = this;
     Time.timeScale      = 1;
     AudioListener.pause = false;
 }
コード例 #16
0
 //Overrides
 public override void onTriggerEnter(PlayerStats stats, ControllerGame controllerGame)
 {
     controllerGame.disconnectRope();
     controllerGame.movePlayerToGameObject(destination);
 }
コード例 #17
0
ファイル: ControllerGame.cs プロジェクト: letsrefreshus/Ropey
    // Use this for initialization
    void Start()
    {
        if(instance == null)
        {
            instance = this;
        }
        else
        {
            Destroy(this.gameObject);
            return;
        }

        _playerStats = objPlayer.GetComponent<PlayerStats>();
        _rigidbodyPlayer = objPlayer.GetComponent<Rigidbody2D>();
        _txtTime = objTime.GetComponent<Text>();
        _txtScore = objScore.GetComponent<Text>();
        _txtTotalTime = objTotalTime.GetComponent<Text>();
        _txtFinalScore = objFinalScore.GetComponent<Text>();
        _txtWinLose = objWinLose.GetComponent<Text>();

        _playerStats.setControllerGame(this);

        startNewGame();
    }
コード例 #18
0
 public abstract void onTriggerEnter(PlayerStats stats, ControllerGame controllerGame);
コード例 #19
0
ファイル: VictoryZone.cs プロジェクト: letsrefreshus/Ropey
 public override void onTriggerEnter(PlayerStats stats, ControllerGame controllerGame)
 {
     controllerGame.gameOver(true);
 }
コード例 #20
0
ファイル: SpeedLimitZone.cs プロジェクト: letsrefreshus/Ropey
 //Overrides
 public override void onTriggerEnter(PlayerStats stats, ControllerGame controllerGame)
 {
     onTriggerStay(stats, controllerGame);
 }
コード例 #21
0
        /// <summary>
        /// Update view items.
        /// </summary>
        private void UpdateGraphics()
        {
            int p1_level, p2_level;

            // The correct values are assigned to the graphic elements based on the round.

            progressBar1.Value = _game.PokemonSelectedPlayer1.HealthPoints;
            progressBar4.Value = _game.PokemonSelectedPlayer1.HealthPoints;
            progressBar2.Value = _game.PokemonSelectedPlayer2.HealthPoints;
            progressBar3.Value = _game.PokemonSelectedPlayer2.HealthPoints;

            if (_game.IsRoundPlayer1)
            {
                labelPlayer.Text = "Player 1";
                _p1 = _game.PokemonSelectedPlayer1;
                _p2 = _game.PokemonSelectedPlayer2;

                progressBar1.BringToFront();
                progressBar2.BringToFront();
            }
            else
            {
                labelPlayer.Text = "Player 2";
                _p1 = _game.PokemonSelectedPlayer2;
                _p2 = _game.PokemonSelectedPlayer1;

                progressBar3.BringToFront();
                progressBar4.BringToFront();
            }

            hp1.Text = _p1.HealthPoints.ToString();
            hp2.Text = _p2.HealthPoints.ToString();

            p1_level = ControllerGame.LevelOf(_p1);
            p2_level = ControllerGame.LevelOf(_p2);

            picture1.Image = Image.FromFile(Properties.Settings.Default.pathSprites +
                                            "/back/" + _p1.Name + ".gif");
            picture2.Image = Image.FromFile(Properties.Settings.Default.pathSprites +
                                            "/front/" + _p2.Name + ".gif");

            labelLevel1.Text = p1_level.ToString();
            labelLevel2.Text = p2_level.ToString();

            labelName1.Text = _p1.Name;
            labelName2.Text = _p2.Name;

            labelExp1.Text = _p1.Exp.ToString();
            labelExp2.Text = _p2.Exp.ToString();

            // Different actions are performed based on the level of the pokemon of the indicator.
            if (p1_level == 1)
            {
                buttonSkill1.Text    = ((Level1)_p1).S1.Name;
                buttonSkill2.Text    = ((Level1)_p1).S2.Name;
                buttonSkill3.Visible = false;
                buttonSkill4.Visible = false;
            }
            else if (p1_level == 2)
            {
                buttonSkill1.Text    = ((Level2)_p1).S1.Name;
                buttonSkill2.Text    = ((Level2)_p1).S2.Name;
                buttonSkill3.Text    = ((Level2)_p1).S3.Name;
                buttonSkill3.Visible = true;
                buttonSkill4.Visible = false;
            }
            else
            {
                buttonSkill1.Text    = ((Level3)_p1).S1.Name;
                buttonSkill2.Text    = ((Level3)_p1).S2.Name;
                buttonSkill3.Text    = ((Level3)_p1).S3.Name;
                buttonSkill4.Text    = ((Level3)_p1).S4.Name;
                buttonSkill3.Visible = true;
                buttonSkill4.Visible = true;
            }
        }
コード例 #22
0
ファイル: VortexZone.cs プロジェクト: letsrefreshus/Ropey
 public override void onTriggerExit(PlayerStats stats, ControllerGame controllerGame)
 {
 }
コード例 #23
0
ファイル: PlayerStats.cs プロジェクト: letsrefreshus/Ropey
 public void setControllerGame(ControllerGame controllerGame)
 {
     _controllerGame = controllerGame;
 }
コード例 #24
0
    public override void Awake()
    {
        base.Awake();

        Instance = this;
    }
コード例 #25
0
ファイル: bubble.cs プロジェクト: mroslander/BoomBalls
    public void SetSpecial(SpecialBubble s, ControllerGame m)
    {
        if (special != null)
            return;

        GameObject so = Instantiate(s.gameObject) as GameObject;
        so.transform.parent = transform;
        so.transform.localPosition = Vector3.zero;

        SpecialBubble newSpecial = so.GetComponent<SpecialBubble>();
        newSpecial.gameManager = m;
        newSpecial.parentBubble = this;

        so.SetActive(true);

        special = newSpecial;
    }