Пример #1
0
    /// <summary>
    /// Initialisierung des TutorialPlayers
    /// </summary>
    void Start()
    {
        tutorialPlayer = this;
        creditShown    = false;

        playerName = "TutorialPlayer";
    }
Пример #2
0
    public Player SpawnTutorialPlayer(Vector2 position)
    {
        Tile spawn_tile = Utils.FindTileAtLocation(position);

        GameObject new_player = Instantiate(player_prefab, spawn_tile.transform);

        Vector3 player_final_position = new_player.transform.position;

        new_player.GetComponent <FallIntoPlace>().SetFinalPosition(player_final_position);
        new_player.GetComponent <FallIntoPlace>().FallSoon();

        new_player.name = "Offender 2";
        new_player.GetComponent <Player>().current_tile = spawn_tile;
        new_player.GetComponent <Player>().team         = Team.A;
        new_player.GetComponent <Player>().SetSprites(player_sprites, player_dunk);

        // Tutorial special
        new_player.GetComponent <Player>().can_select = false;
        TutorialPlayer tutorial = new_player.AddComponent <TutorialPlayer>();

        tutorial.can_move = true;

        all_objects.Add(new_player);

        new_player.GetComponent <Player>().DetermineSpriteFacing(spawn_tile, Utils.FindTileAtLocation(new Vector2(5, 2)));

        new_player.transform.Translate(new Vector3(0, 10, 0), Space.World);

        return(new_player.GetComponent <Player>());
    }
    /// <summary>
    /// Steuert den Start des Tutorials.
    /// </summary>
    // Use this for initialization
    void Start()
    {
        tutorialPlayer = TutorialPlayer.tutorialPlayer;
        weather        = GameObject.Find("Weather");
        // Zu Beginn des Spiels Wetteranzeige aktivieren, andere Objekte deaktivieren
        weatherPanel.SetActive(true);
        step1.SetActive(true);
        step1Open = true;
        selectionPanel.SetActive(false);
        errorMessage.text = "";
        gameButtonsPanel.SetActive(false);

        // Definiert welcher Schritt gerade angezeigt wird
        step11Open = step2Open = step3Open = step4Open = step5Open = step6Open = step7Open = step8Open = false;
        step2.GetComponentInChildren <Button>().onClick.AddListener(TaskOnStep2);
        harvestAllButton.onClick.AddListener(TaskOnStep6);
        step71.GetComponentInChildren <Button>().onClick.AddListener(TaskOnStep71);

        // Collider der Felder definieren
        collider1 = field1.GetComponent <Collider2D>();
        collider2 = field2.GetComponent <Collider2D>();
        collider3 = field3.GetComponent <Collider2D>();
        collider4 = field4.GetComponent <Collider2D>();

        // Collider beim Start deaktivieren, damit Felder nicht interaktiv sind
        collider1.enabled = false;
        collider2.enabled = false;
        collider3.enabled = false;
        collider4.enabled = false;

        confirmButton.onClick.AddListener(TaskOnConfirm);
        rejectButton.onClick.AddListener(TaskOnReject);
    }
Пример #4
0
    public void StartTutorial()
    {
        SetTutorialStrings();

        canvas        = GameObject.Find("Canvas");
        tutorial_text = canvas.transform.Find("Tutorial Box/Tutorial Text").GetComponent <Text>();
        AdvanceText();

        // Turn off stuff
        highlight = FindObjectOfType <Highlight>();
        highlight.InMenu();

        canvas.transform.Find("Score Panel").gameObject.SetActive(false);
        canvas.transform.Find("Team X Turn").gameObject.SetActive(false);
        canvas.transform.Find("End Turn").gameObject.SetActive(false);
        canvas.transform.Find("Shot Clock").gameObject.SetActive(false);

        canvas.transform.Find("End Tutorial").gameObject.SetActive(true);

        FindObjectOfType <Ball>().ToggleDribble();

        player_character = FindObjectsOfType <Player>()[1];
        TutorialPlayer tutorial = player_character.gameObject.AddComponent <TutorialPlayer>();

        tutorial.can_move = false;
        tutorial.can_pass = true;

        tutorial_talker = FindObjectsOfType <Player>()[0];
        StartCoroutine(DelayAppear());

        end_tutorial_timer = Time.timeSinceLevelLoad;
    }
Пример #5
0
 // Use this for initialization
 void Start()
 {
     obj = GameObject.Find("TestCube");
     r = 255;
     b = 255;
     timeOut = 0.01f;
     pla = GameObject.Find("player");
     tutorialPlayer = pla.GetComponent<TutorialPlayer>();
     Debug.Log(tutorialPlayer);
 }
Пример #6
0
    public Character makeTutorialPlayer(int ID, string characterModelLocation, string materialLocation, string className, Vector3 spawnLocation, Color color)
    {
        GameObject obj = (GameObject)Instantiate (Resources.Load(characterModelLocation), spawnLocation, new Quaternion ());

        obj.renderer.material = (Material)Resources.Load (materialLocation);

        player = (TutorialPlayer)obj.AddComponent(className);
        player.tutorialMode = true;
        player.initialize (ID, this.gameObject);
        player.tutorialRespawnLocation = spawnLocation;

        return player;
    }
Пример #7
0
    public Character makeTutorialPlayer(int ID, string characterModelLocation, string materialLocation, string className, Vector3 spawnLocation, Color color)
    {
        GameObject obj = (GameObject)Instantiate(Resources.Load(characterModelLocation), spawnLocation, new Quaternion());

        obj.renderer.material = (Material)Resources.Load(materialLocation);

        player = (TutorialPlayer)obj.AddComponent(className);
        player.tutorialMode = true;
        player.initialize(ID, this.gameObject);
        player.tutorialRespawnLocation = spawnLocation;

        return(player);
    }
Пример #8
0
        public override void AI()
        {
            Player         player    = Main.player[projectile.owner];
            TutorialPlayer modPlayer = player.GetModPlayer <TutorialPlayer>(mod);

            if (player.dead)
            {
                modPlayer.tutorialPet = false;
            }
            if (modPlayer.tutorialPet)
            {
                projectile.timeLeft = 2; // Remain at 2 while tutorialPet == true;
            }
        }
Пример #9
0
        public override void CheckActive()
        {
            Player         player         = Main.player[projectile.owner];
            TutorialPlayer tutorialPlayer = player.GetModPlayer <TutorialPlayer>(mod);

            if (player.dead)
            {
                tutorialPlayer.summonSpiritMinion = false;
            }
            if (tutorialPlayer.summonSpiritMinion)
            {
                projectile.timeLeft = 2;
            }
        }
Пример #10
0
        public override void CheckActive()
        {
            Player player = Main.player[projectile.owner];
            //tutorialPlayer TutorialPlayer = getModPlayer<TutorialPlayer>();

            TutorialPlayer tutorialPlayer = player.GetModPlayer <TutorialPlayer>();

            if (player.dead)
            {
                tutorialPlayer.summonSpiritMinion = true;     //hoping this keeps it after you die if not, change this to false.
            }
            if (tutorialPlayer.summonSpiritMinion)
            {
                projectile.timeLeft = 2;
            }
        }
Пример #11
0
    public void OnTriggerEnter2D(Collider2D other)
    {
        TutorialPlayer tp = other.GetComponent <TutorialPlayer>();

        if (tp != null)
        {
            gameObject.SetActive(false);
            tp.Collect(currentType);
            switch (currentType)
            {
            case Type.Coin:
                AudioController.controller.PlaySound(SoundType.Coin);
                break;

            case Type.Star:
                AudioController.controller.PlaySound(SoundType.Star);
                break;

            case Type.Boost:
                AudioController.controller.PlaySound(SoundType.Boost);
                break;
            }
        }
        else
        {
            Player p = other.GetComponent <Player>();
            if (p != null)
            {
                gameObject.SetActive(false);
                p.Collect(currentType);
                switch (currentType)
                {
                case Type.Coin:
                    AudioController.controller.PlaySound(SoundType.Coin);
                    break;

                case Type.Star:
                    AudioController.controller.PlaySound(SoundType.Star);
                    break;

                case Type.Boost:
                    AudioController.controller.PlaySound(SoundType.Boost);
                    break;
                }
            }
        }
    }
Пример #12
0
        public override void Update(Player player, ref int buffIndex)
        {
            TutorialPlayer tutorialPlayer = player.GetModPlayer <TutorialPlayer>(mod);

            if (player.ownedProjectileCounts[mod.ProjectileType("Bill Cypher")] > 0)
            {
                tutorialPlayer.summonSpiritMinion = true;
            }
            if (!tutorialPlayer.summonSpiritMinion)
            {
                player.DelBuff(buffIndex);
                buffIndex--;
            }
            else
            {
                player.buffTime[buffIndex] = 18000;
            }
        }
Пример #13
0
 /// <summary>
 /// Initialisierung der Money-Objekte.
 /// </summary>
 void Start()
 {
     weather        = GameObject.Find("Weather");
     moneyText      = GetComponent <TextMeshProUGUI>();
     moneyText.text = money.ToString();
     if (weather.GetComponent <Weather>().seasonNumber != 0)
     {
         player     = Player.player;
         this.money = player.money;
         tutorial   = false;
     }
     else
     {
         tutorialPlayer = TutorialPlayer.tutorialPlayer;
         this.money     = tutorialPlayer.money;
         tutorial       = true;
     }
 }
Пример #14
0
    /// <summary>
    /// Ueberprueft fuer <c>Harvest.cs</c> ob sich das Spiel im Moment im Tutorial oder im eigentlichen
    /// Spielablauf befindet. Ausserdem wird die Methode <c>TaskOnClick</c> ausgefuehrt, wenn der <c>harvestFieldButton</c>
    /// gedrueckt wird.
    /// </summary>
    void Start()
    {
        weather = GameObject.Find("Weather");
        if (weather.GetComponent <Weather>().seasonNumber != 0)
        {
            player   = Player.player;
            tutorial = false;
        }
        else
        {
            tutorialPlayer = TutorialPlayer.tutorialPlayer;
            tutorial       = true;
        }

        seasonName = weather.GetComponent <Weather>().seasonName;

        plant = field.GetComponent <Field>().plant;

        missHarvestQuota = 1;
        field.changeSprite();

        harvestFieldButton.onClick.AddListener(TaskOnClick);
    }
Пример #15
0
    void OnTriggerEnter2D(Collider2D collider)
    {
        if (collider.tag == "Player")
        {
            //ONLY WORKS IN TUTORIAL
            TutorialPlayer tPlayerController = collider.gameObject.GetComponent <TutorialPlayer>();

            switch (rollover_mode)
            {
            case tutorial_states.dark_locked:
                tPlayerController.switch_to_dark();
                break;

            case tutorial_states.light_locked:
                tPlayerController.switch_to_light();
                break;

            default:
            case tutorial_states.full_control:
                tPlayerController.activate_full_control();
                break;
            }
        }
    }
Пример #16
0
        private void CreateTutorialStages()
        {
            string clickTapString = "clicking on";
            string clickAnywhere  = "click anywhere";

#if UNITY_ANDROID
            clickTapString = "tapping";
            clickAnywhere  = "tap the screen";
#endif
            string username = GameManager.Instance.UserName;

            stages = new Queue <TutorialStage>();

            string text = "Hi " + username + "! Welcome to Fruitons! Let me quickly introduce you to the basics." +
                          " Whenever I become too boring just " + clickAnywhere + " to load the text instantly.";
            stages.Enqueue(new TutorialStage(text));

            text = "These are your Fruitons. Take a good care of them, they will fight and even die for you.";
            Func <ClientFruiton, bool> isMine = clientFruiton => clientFruiton.KernelFruiton.owner.id == ((AIBattle)battleViewer.battle).HumanPlayer.ID;
            stages.Enqueue(new TutorialStage(text, () => FilterFruitons(false, isMine)));

            text = "These are the Fruitons of your enemy. Beware of them, they might appear innocent but their hearts are full of rage and bloodlust.";
            Func <ClientFruiton, bool> isOpponent = clientFruiton => clientFruiton.KernelFruiton.owner.id == ((AIBattle)battleViewer.battle).AiPlayer.ID;
            stages.Enqueue(new TutorialStage(text, () => FilterFruitons(false, isOpponent)));

            text = "What you see now are kings. Protect your king by all means because at the moment one of the king dies, its owner loses and the other player wins.";
            Func <ClientFruiton, bool> isKing = clientFruiton => clientFruiton.KernelFruiton.type == (int)FruitonType.KING;
            stages.Enqueue(new TutorialStage(text, () => FilterFruitons(false, isKing)));

            text = "There are 4 major pieces, 2 to the left of the king and 2 to the right. They use to be strong warriors and have special abilities.";
            Func <ClientFruiton, bool> isMajor = clientFruiton => clientFruiton.KernelFruiton.type == (int)FruitonType.MAJOR;
            stages.Enqueue(new TutorialStage(text, () => FilterFruitons(false, isMajor)));

            text = "Don't ever underestimate the front line, the minor pieces. They may appear to be weak cowards but without" +
                   " them your king would be exposed directly to the wrath of your enemy.";
            Func <ClientFruiton, bool> isMinor = clientFruiton => clientFruiton.KernelFruiton.type == (int)FruitonType.MINOR;
            stages.Enqueue(new TutorialStage(text, () => FilterFruitons(false, isMinor)));

            text = "The red circles under the Fruitons show their health points (HP), a Fruiton only lives while it has at least 1 HP.";
            Func <ClientFruiton, GameObject> getHealthTag = clientFruiton => clientFruiton.HealthTag.gameObject.transform.parent.gameObject;
            stages.Enqueue(new TutorialStage(text, () => GetObjectsRelativeToFruitons(getHealthTag)));

            text = "On the contrary, the yellow circles show how much damage a Fruiton causes when attacking an enemy Fruiton.";
            Func <ClientFruiton, GameObject> getDamageTag = clientFruiton => clientFruiton.DamageTag.gameObject.transform.parent.gameObject;
            stages.Enqueue(new TutorialStage(text, () => GetObjectsRelativeToFruitons(getDamageTag)));

            text = "And there it is, the decription. You can find there everything important such as special abilities or effects.";
            TutorialStage descriptionStage = new TutorialStage(
                text,
                () => new List <GameObject> {
                battleViewer.FruitonInfoPanel
            },
                endActions: new List <Action> {
                () => battleViewer.FruitonInfoPanel.SetActive(false)
            },
                scalingRate: 0.2f);

#if UNITY_ANDROID
            text = "To see the detailed decription of a fruiton, switch to the \"Info mode\" first.";
            stages.Enqueue(new TutorialStage(
                               text,
                               () => new List <GameObject> {
                battleViewer.InfoAndroidButton.gameObject
            },
                               endCondition: TutorialStage.StageEndCondition.DifferentButtonClick,
                               startActions: new List <Action> {
                () => battleViewer.InfoAndroidButton.enabled = true
            },
                               endActions: new List <Action> {
                () => battleViewer.InfoAndroidButton.enabled = false
            }));

            text = "Now you are in the \"Info mode\". To see the detailed decription of a fruiton, tap the tile he is standing on.";
            stages.Enqueue(new TutorialStage(
                               text,
                               () => FilterFruitons(true),
                               endCondition: TutorialStage.StageEndCondition.LeftClickHighlighted,
                               scaleHighlight: false));

            stages.Enqueue(descriptionStage);

            text = "Switch the \"Info mode\" off now.";
            stages.Enqueue(new TutorialStage(
                               text,
                               () => new List <GameObject> {
                battleViewer.InfoAndroidButton.gameObject
            },
                               endCondition: TutorialStage.StageEndCondition.DifferentButtonClick,
                               startActions: new List <Action> {
                () => battleViewer.InfoAndroidButton.enabled = true
            },
                               endActions: new List <Action> {
                () => battleViewer.InfoAndroidButton.enabled = false
            }));
#else
            text = "To see the detailed decription of a fruiton, move the mouse over the tile he is standing on.";
            stages.Enqueue(new TutorialStage(
                               text,
                               () => FilterFruitons(true),
                               endCondition: TutorialStage.StageEndCondition.HoverOverHighlighted,
                               scaleHighlight: false));

            stages.Enqueue(descriptionStage);
#endif

            text = "This is Hourglass button used to end your turn.";
            stages.Enqueue(new TutorialStage(
                               text,
                               () => new List <GameObject> {
                battleViewer.EndTurnButton.gameObject
            }));

            text = "The timer shows you how many seconds you have to complete your turn. If you can't make it, " +
                   "your turn will be ended automatically when the timer reaches 0. However, don't worry about it in this tutorial.";
            stages.Enqueue(new TutorialStage(
                               text,
                               () => new List <GameObject> {
                battleViewer.TimeCounter.transform.parent.gameObject
            },
                               startActions: new List <Action> {
                () => battleViewer.TimeCounter.gameObject.SetActive(true)
            },
                               updateActions: new List <Action> {
                battleViewer.UpdateTimer
            },
                               endActions: new List <Action> {
                () => battleViewer.TimeCounter.gameObject.SetActive(false)
            }));

            text = "And the (highly unrecommended!) surrender button. Fight until your last breath!";
            stages.Enqueue(new TutorialStage(
                               text,
                               () => new List <GameObject> {
                battleViewer.SurrendButton.gameObject
            }));

            text = "Well, enough with this jibber-jabber. Let's play! You can choose a fruiton by " + clickTapString +
                   " the tile he is standing on. Try this one.";
            stages.Enqueue(new TutorialStage(
                               text,
                               () => new List <GameObject> {
                battleViewer.GridLayoutManager.GetTile(2, 0)
            },
                               endCondition: TutorialStage.StageEndCondition.LeftClickHighlighted,
                               scaleHighlight: false));

            text =
                "Oh look, everything turned into the rainbow. Lovely, isn't it? In each turn you can perform at most 2 " +
                "actions with a single fruiton. You can move and attack/heal or just one of these. Remember that you" +
                " can't move after you attack/heal.";
            stages.Enqueue(new TutorialStage(text));

            text = "Blue tiles are the ones where you can move by " + clickTapString + " them.";
            stages.Enqueue(new TutorialStage(
                               text,
                               () => battleViewer.GridLayoutManager.GetMovementTiles(),
                               scaleHighlight: false));

            text = "These are the obstacles. No one is able to step on an obstacle.";
            stages.Enqueue(new TutorialStage(
                               text,
                               () => battleViewer.GridLayoutManager.Obstacles,
                               scaleHighlight: false));

            text = "Yellow tiles are a little bit tricky. They mark your possible attack locations in this turn, " +
                   "if you move close enough to them.";
            stages.Enqueue(new TutorialStage(
                               text,
                               () => battleViewer.GridLayoutManager.GetTentativeAttacks(),
                               scaleHighlight: false));

            text = "Let's try moving here with the selected fruiton.";
            stages.Enqueue(new TutorialStage(
                               text,
                               () => new List <GameObject> {
                battleViewer.GridLayoutManager.GetTile(4, 7)
            },
                               endCondition: TutorialStage.StageEndCondition.LeftClickHighlighted,
                               scaleHighlight: false));

            TutorialPlayer opponent = (TutorialPlayer)((AIBattle)battleViewer.battle).AiPlayer;

            text = "Well done! After you move a fruiton, he becomes the only fruiton that can attack/heal that turn." +
                   " The remaining actions are automatically highlighted. You can attack fruitons on the red tiles." +
                   " Attack the one in the middle.";
            stages.Enqueue(new TutorialStage(
                               text,
                               () => new List <GameObject> {
                battleViewer.GridLayoutManager.GetTile(4, 8)
            },
                               endCondition: TutorialStage.StageEndCondition.LeftClickHighlighted,
                               scaleHighlight: false,
                               endActions: new List <Action> {
                () => opponent.MakeMove()
            }));

            text = "You have no more actions available in this turn. Press the Hourglass button to end it and let your opponent play.";
            stages.Enqueue(new TutorialStage(
                               text,
                               () => new List <GameObject> {
                battleViewer.EndTurnButton.gameObject
            },
                               endCondition: TutorialStage.StageEndCondition.DifferentButtonClick,
                               startActions: new List <Action> {
                () => battleViewer.EndTurnButton.enabled = true
            },
                               endActions: new List <Action> {
                () => battleViewer.EndTurnButton.enabled = false
            }
                               ));

            Func <ClientFruiton, bool> isHealer = clientFruiton => clientFruiton.KernelFruiton.currentAttributes.heal > 0;

            text = "Ouch, your Fruiton was hit. Let's fix this, select a healer.";
            stages.Enqueue(new TutorialStage(
                               text,
                               () => FilterFruitons(true, isMine, isHealer),
                               endCondition: TutorialStage.StageEndCondition.LeftClickHighlighted,
                               scaleHighlight: false
                               ));

            text = "Green tiles mark fruitons that can be healed. Heal the injured one now.";
            stages.Enqueue(new TutorialStage(
                               text,
                               () => new List <GameObject> {
                battleViewer.GridLayoutManager.GetTile(4, 7)
            },
                               endCondition: TutorialStage.StageEndCondition.LeftClickHighlighted,
                               scaleHighlight: false));

            stages.Enqueue(new TutorialStage("You did well, " + username + ", it's time for real challenges now! "));
            NextStage();
        }
Пример #17
0
 void Awake()
 {
     rb     = GetComponent <Rigidbody2D>();
     player = GetComponent <TutorialPlayer>();
 }