// Use this for initialization void Start() { rigid = GetComponent <Rigidbody2D> (); anim = GetComponent <Animator> (); bossButtonScript = GetComponent <BossButton> (); rigid.AddForce(transform.up * speed); }
void Start() { projectileVelocity = 3; bossButtonScript = GetComponent <BossButton> (); anim = GetComponent <Animator> (); nailScript = GetComponent <Nails> (); rigid = GetComponent <Rigidbody2D> (); InvokeRepeating("FinalProjectileMachine", 2, 5); }
internal void MultipleAnswers(BossMonster boss, BossButton a_running) { //Spacing prevents answers from being spread out at first, but slowly expands them as we continue. int spacing = boss.bossSpacing; if (spacing > answers.Length)//If we have a range that is over our threshold, we'll have to clamp it back down. { spacing = answers.Length; } DisableMultiple();//Turn off all buttons. enemyAnswerNeeded = boss.answerNeeded; player.SetTime(true, a_running.levelTime); foreach (AdditionAnswer item in answers) //Set answers to negative. Easier to find if they're inactive now. { item.SetAnswer(-1); } int index = Random.Range(0, spacing); //Our list of duplicates. If you're the same, you're invalid. answersList = new List <int>(); //One Answer is set to be correct. answers[index].gameObject.SetActive(true); answers[index].SetAnswer(enemyAnswerNeeded); answersList.Add(enemyAnswerNeeded); for (int i = 1; i < a_running.enemyChoices; i++) { int wrongAnswer = -3; while (wrongAnswer < a_running.minNumber || CheckMultiple(a_running, wrongAnswer)) //Continue looping if we have a dupe, or the number is under 0, essentially. { int range = Random.Range(-a_running.enemyAnswerRange, a_running.enemyAnswerRange); wrongAnswer = enemyAnswerNeeded + range; } index = Random.Range(0, spacing); while (answers[index].GetAnswer() != -1) //continue looking for buttons until we find an empty one. { index = Random.Range(0, spacing); } answers[index].gameObject.SetActive(true); answers[index].SetAnswer(wrongAnswer); } }
// Use this for initialization void Start() { anim = GetComponent <Animator> (); bossButtonScript = GetComponent <BossButton> (); bossScript = GetComponent <rotateTo> (); }
//Monster is initiated. public override void loadMonster() { ArrowsFired = false; ArrowContainer.SetActive(false); questions = FindObjectOfType <questionManager>(); if (!multipleContainer) { multipleContainer = FindObjectOfType <multipleContainer>(); } multipleContainer.SetAttacks(true, false); multipleContainer.DisableThisAndCalculator(); m_button = (BossButton)parent.quizRunning; Operator = parent.quizRunning.Operator; if (Operator == operators.Addition) //Addition resets in difficulty. { m_button.enemyChoices = 2; m_button.enemyAnswerRange = 3; bossSpacing = 4; } if (Operator > operators.Division && m_button.quizIndex < 9) { Fortress.SetPatience(5); } else { Fortress.patience.gameObject.SetActive(false); } if (sprite != null) { Destroy(sprite.gameObject); } if (parent.quizRunning.monsterArt != null) { sprite = Instantiate(parent.quizRunning.monsterArt, monsterSpot.transform, false); sprite.transform.localScale = parent.quizRunning.monsterArt.transform.localScale; animator = sprite.GetComponentInChildren <Animator>(); startingPosition = sprite.transform.localPosition; startingRotation = sprite.transform.localRotation; } enemyPhase = false; health = parent.quizRunning.MonsterHealth; attack = parent.quizRunning.MonsterAttack; if (Operator == operators.Multiplication) { bar.setMaxHealth(health, false, true); validNumbers = 2; multHealthOne = 4; multHealthTwo = 4; multHealthThree = 4; Heads = 3; multAttacks = 3; } else { bar.setMaxHealth(health, false); } if (!music) { music = FindObjectOfType <MusicManager>(); } if (music) { music.SetCombatMusic(parent.quizRunning.Operator, parent.quizRunning.boss); } if (Operator == operators.Subtraction) { subtractionContainer.SetUpSubtraction(health); } CreateQuestion(); }