void Start()
 {
     instance = this;
     sr       = GetComponentInChildren <SpriteRenderer>();
     r        = GetComponent <Rigidbody2D>();
     InvokeRepeating("SwapSprite", PropellerSpeed, PropellerSpeed);
 }
    /*** Init Method ***/
    public void Start()
    {
        UIController.GetComponent <UIControl>().cusrorLocked = true;

        playerSub = GetComponent <PlayerSub>();

        lookSpeedSlider.value = lookSpeed;
        lookSpeedSlider.onValueChanged.AddListener(delegate { UpdateLookSpeed(); });
    }
Exemple #3
0
    // Called when the node enters the scene tree for the first time.
    public override void _Ready()
    {
        ScoreSummaryTimer = GetNode <Timer>("ScoreSummaryTimer");
        TimeStarted       = DateTime.Now;
        OS.CenterWindow();
        LastObstacle = DateTime.Now;
        LastCreature = DateTime.Now;

        ScoreCanvas               = GetNode <CanvasLayer>("ScoreCanvas");
        PlayerMoneyLabel          = GetNode <Label>("ScoreCanvas/PlayerMoneyLabel");
        DepthLabel                = GetNode <Label>("ScoreCanvas/DepthLabel");
        GameOverTimer             = GetNode <Timer>("GameOverTimer");
        PlayerSub                 = (PlayerSub)GetNode("PlayerSub");
        CircleWipeAnimationPlayer = (AnimationPlayer)GetNode("CircleWipe/ColorRect/AnimationPlayer");

        var globalVars = GlobalManager.GetGlobalGameVariables(this);

        globalVars.PlayerSub = PlayerSub;

        RandomNumberGenerator = new RandomNumberGenerator();
        RandomNumberGenerator.Randomize();

        LeftWall  = GetNode <Wall>("LeftWall");
        LeftWall2 = GetNode <Wall>("LeftWall2");

        RightWall  = GetNode <Wall>("RightWall");
        RightWall2 = GetNode <Wall>("RightWall2");

        LeftWall.GlobalPosition  = new Vector2(LeftWall.GlobalPosition.x, 0);
        RightWall.GlobalPosition = new Vector2(RightWall.GlobalPosition.x, 0);

        LeftWall2.GlobalPosition  = new Vector2(LeftWall.GlobalPosition.x, LeftWall2.CollisionHeight * 2);
        RightWall2.GlobalPosition = new Vector2(RightWall.GlobalPosition.x, RightWall2.CollisionHeight * 2);

        GameIsStarting = true;
        CircleWipeAnimationPlayer.Play("circle_out");

        SetPlayerMoneyText();
    }
Exemple #4
0
    public override void _Ready()
    {
        TimerSound = GetNode <AudioStreamPlayer>("TimerSound");

        MoneyLabel  = GetNode <Label>("CanvasLayer/MoneyLabel");
        LaunchTimer = GetNode <Timer>("LaunchTimer");

        LaunchLabel = GetNode <Label>("CanvasLayer2/Label");
        SubBobTween = GetNode <Tween>("SubBobTween");
        Water1Tween = GetNode <Tween>("Water1GrowTween");
        Water1Rect  = GetNode <ColorRect>("Water1Rect");

        Water2Tween = GetNode <Tween>("Water2GrowTween");
        Water2Rect  = GetNode <ColorRect>("Water2Rect");

        Water3Tween = GetNode <Tween>("Water3GrowTween");
        Water3Rect  = GetNode <ColorRect>("Water3Rect");

        PlayerSub = GetNode <PlayerSub>("PlayerSub");

        StartPlayerBobTween();
        StartWater1Tween();
        StartWater2Tween();
        StartWater3Tween();

        PlayerSub.OnSurface = true;
        PlayerSub.StartBubbler(false);

        CircleWipeAnimationPlayer = (AnimationPlayer)GetNode("CircleWipe/ColorRect/AnimationPlayer");

        MoneyLabel.Text = "$" + GlobalManager.GetPlayerMoney(this);
        if (GlobalManager.LevelHasBeenPlayed(this))
        {
            IsWipeIn = true;
            CircleWipeAnimationPlayer.Play("circle_out");
        }
        GlobalManager.SetLevelHasBeenPlayed(this);
    }
Exemple #5
0
    private void OnChat(object[] objs)
    {
        int       position = (int)objs[0];
        int       idx      = Game.MJMgr.GetIndexByPosition(position);
        PlayerSub player   = players[idx];

        int type = (int)objs[1];

        switch (type)
        {
        case 0:
            int index = (int)objs[2];
            player.ShowMood(index);
            break;

        case 1:
            int        id     = (int)objs[2];
            ConfigWord config = ConfigWord.GetByKey(id);
            if (null != config)
            {
                player.ShowWord(config.TextContent);
                Game.SoundManager.PlayVoice(position, config.Talk);
            }
            break;

        case 2:
            string str = (string)objs[2];
            player.ShowWord(str);
            break;

        case 3:
            byte[] data = (byte[])objs[2];
            player.ShowVoice(data, detail.AudioSource_MicrophoneInput);
            break;
        }
    }
 // Use this for initialization
 void Start()
 {
     motor = GetComponent <PlayerSub>();
     motor.SetMaxSpeed(maxSpeed);
 }
Exemple #7
0
 void Start()
 {
     player = GameObject.FindObjectOfType<PlayerSub> ();
 }