private void Awake()
    {
        //Find the windArrow child.
        windArrow = GetComponentInChildren <WindArrow>();
        if (windArrow == null)
        {
            Debug.LogError("You need a Wind Arrow as a child to the game manager!");
        }

        //Find Wind handler in the world. If found, randomize the wind direction.
        windHandler = FindObjectOfType <WindHandler>();
        if (windHandler == null)
        {
            Debug.LogError("You need a Wind Handler in the game!");
        }
        else
        {
            ChangeWind();
        }

        //Check if theres a spawn group. If so, get the spawn points.
        if (spawnPointGroup == null)
        {
            Debug.LogError("You need to assign a spawn point group!");
        }
        else
        {
            spawnPoints = spawnPointGroup.GetComponentsInChildren <SpawnPoint>();
        }
    }
Exemple #2
0
    public void ReleaseCast()
    {
        GameObject windArrow = poolManager.GetGameObject("WindArrow");
        WindArrow  a         = windArrow.GetComponent <WindArrow>();

        a.SetThrower(player);

        //根据风瞄准镜设置生成位置
        flyingStartPositon.y = player.transform.position.y;
        flyingStartPositon.x = player.transform.position.x + 1.0f * player.transform.localScale.x;
        a.SetStartPosition(flyingStartPositon);

        //设置方向
        a.SetDirection(windAbility.GetSightHeadPosition());
    }
Exemple #3
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            playerBall = new PlayerBall(new Vector2(ballRadius * 2, windowHeigth / 2), 0, Vector2.Zero, Vector2.Zero, ballRadius, BallType.PLAYER, Color.White);

            enemyBall = new Ball(new Vector2(windowWidth / 2, windowHeigth / 2), 0, Vector2.Zero, Vector2.Zero, ballRadius, BallType.ENEMY, Color.Yellow);

            targetBall = new Ball(new Vector2(2, 1), 0, Vector2.Zero, Vector2.Zero, ballRadius, BallType.TARGET, Color.Red);

            mouseArrow = new MouseArrow(new Vector2(ballRadius * 4, windowHeigth / 2), 0,
                                        Vector2.Zero, Vector2.Zero, Content.Load <Texture2D>("arrow"));

            windArrow = new WindArrow(new Vector2(1, 1.3f), 0,
                                      Vector2.Zero, Vector2.Zero, Content.Load <Texture2D>("arrow"));

            // TODO: use this.Content to load your game content here
        }
 private void Awake()
 {
     singleton = this;
     arrow     = GameObject.FindObjectOfType <WindArrow>();
 }