Inheritance: MonoBehaviour
示例#1
0
 void Start()
 {
     finalCollider = GetComponent <CapsuleCollider2D>();
     bossScript    = GameObject.Find("Boss").GetComponent <BossScript>();
     playerScript  = GameObject.Find("Player").GetComponent <PlayerMove>();
     brotherScript = GameObject.Find("FinalBrother").GetComponent <FinalBrother>();
 }
示例#2
0
 void OnTriggerEnter2D(Collider2D col)
 {
     if (col.gameObject.name == "DestroyableCrate(Clone)")
     {
         Destroy(col.gameObject);
         Destroy(gameObject);
     }
     else if (col.gameObject.name == "Crate(Clone)")
     {
         Destroy(gameObject);
     }
     else if (col.gameObject.name == "Enemy(Clone)")
     {
         GameController gc = FindObjectOfType <GameController>();
         gc.playerPoints += 3;
         Debug.Log("Added Point!");
         Destroy(gameObject);
         Destroy(col.gameObject);
     }
     else if (col.gameObject.name == "Boss(Clone)")
     {
         BossScript boss = FindObjectOfType <BossScript>();
         boss.lifePoints -= damage;
         Debug.Log(boss.lifePoints.ToString());
         Destroy(gameObject);
         if (boss.lifePoints <= 0)
         {
             Destroy(col.gameObject);
         }
     }
 }
示例#3
0
 void Start()
 {
     maxHealth     = setMax;
     currentHealth = maxHealth;
     enemy         = GetComponent <BossScript>();
     enable        = key.GetComponent <Enabler>();
 }
示例#4
0
    void OnCollisionEnter(Collision col)
    {
        if (col.gameObject.name == "Wall")
        {
            Destroy (gameObject);

        }
        else if (col.gameObject.name == "BlueVirus"){
            bVirus = col.gameObject.GetComponent<BlueVirus>();
            bVirus.takeDamage (1,1);
            Destroy (gameObject);
        }
        else if (col.gameObject.name == "RedVirus"){
            Destroy (gameObject);
        }
        else if (col.gameObject.name == "GreenVirus"){
            gVirus = col.gameObject.GetComponent<GreenVirus>();
            gVirus.takeDamage (1,1);
            Destroy (gameObject);
        }else if(col.gameObject.name == "Boss"){
            boss = col.gameObject.GetComponent<BossScript>();
            boss.takeDamage(1, 1);
            Destroy(gameObject);
        }
    }
示例#5
0
    private void OnTriggerStay2D(Collider2D other)
    {
        if (other.gameObject.tag == "Enemy")
        {
            inRange = true;
        }

        if (other.gameObject.tag == "Enemy" && targetHealth == null)
        {
            targetHealth = other.GetComponent <EnemyMeleeScript>();
        }


        if (other.gameObject.tag == "Ranged")
        {
            inRangeRanged = true;
        }

        if (other.gameObject.tag == "Ranged" && enemyHealth == null)
        {
            enemyHealth = other.GetComponent <EnemyRangedScript>();
        }


        if (other.gameObject.tag == "Boss")
        {
            inRangeBoss = true;
        }

        if (other.gameObject.tag == "Boss" && BossHealth == null)
        {
            BossHealth = other.GetComponent <BossScript>();
        }
    }
    // Start is called before the first frame update
    void Awake()
    {
        // Chamadas do player
        player           = GameObject.FindGameObjectWithTag("Player"); // declara player, como player
        playerController = player.GetComponent <PlayerController>();   // chama o script de playerController pra dentro desse script
        player_ATK       = player.GetComponent <Player_ATK>();         // chama o script de player pra dentro desse script
        player_Magic     = player.GetComponent <Player_Magic>();       // chama o script de player pra dentro desse script


        // chamadas da camera
        Camera       = GameObject.FindGameObjectWithTag("MainCamera"); // declara camera como camera
        CameraAjuste = Camera.GetComponent <CameraFollow>();           // chama o script de camera para dentro desse script

        // Chamadas do boss
        Rollo       = GameObject.FindGameObjectWithTag("Boss");
        RolloScript = Rollo.GetComponent <BossScript>();
        BossAnim    = RolloScript.GetComponent <Animator>();


        // chamadas de Animator
        Anim = GetComponent <Animator>();

        // chamadas de audio
        AudioSource.clip = BossVoice;
    }
 void Start()
 {
     GCS        = GameObject.FindGameObjectWithTag("GameScripts").GetComponent <GameController> ();
     BossScript = Boss.GetComponent <BossScript> ();
     StartCoroutine(Shooting());
     HP += GCS.Difficulty * 2;
 }
 void Start()
 {
     rb        = GetComponent <Rigidbody2D>();
     bowser    = GameObject.Find("Bowser").GetComponent <BossScript>();
     speed     = 25f;
     direction = bowser.direction;
 }
    private void Startrup()
    {
        instance = this;

        switch (difficulty)
        {
        case 1:
            MaxHP   = MaxMana = MaxStamina = 100;
            StartHP = StartMana = StartStamina = 100;
            currHP  = currMana = currStamina = 100;
            break;

        case 2:
            MaxHP   = MaxMana = MaxStamina = 70;
            StartHP = StartMana = StartStamina = 70;
            currHP  = currMana = currStamina = 70;
            break;

        case 3:
            MaxHP   = MaxMana = MaxStamina = 50;
            StartHP = StartMana = StartStamina = 50;
            currHP  = currMana = currStamina = 50;
            break;
        }
        TimerBar.maxValue   = time;
        HPBar.maxValue      = MaxHP;
        ManaBar.maxValue    = MaxMana;
        Staminabar.maxValue = MaxStamina;

        timeleft         = time;
        HPBar.value      = MaxHP;
        ManaBar.value    = MaxMana;
        Staminabar.value = MaxStamina;
        GenerateNeededItem();
    }
示例#10
0
    void OnCollisionEnter2D(Collision2D collision)
    {
        bool damagePlayer = false;

        // столкновение с врагом
        EnemyScript enemy = collision.gameObject.GetComponent <EnemyScript>();

        if (enemy != null)
        {
            // убиваем врага
            HealthScript enemyHealth = enemy.GetComponent <HealthScript>();
            if (enemyHealth != null)
            {
                enemyHealth.Damage(enemyHealth.hp);
            }
            damagePlayer = true;
        }

        BossScript boss = collision.gameObject.GetComponent <BossScript>();

        if (boss != null)
        {
            damagePlayer = true;
        }

        // повреждения у игрока
        if (damagePlayer)
        {
            HealthScript playerHealth = this.GetComponent <HealthScript>();
            if (playerHealth != null)
            {
                playerHealth.Damage(1);
            }
        }
    }
示例#11
0
 // Use this for initialization
 void Start()
 {
     if (musicPlayer != null)
     {
         musicScript = musicPlayer.GetComponent <MusicPlayerScript>();
     }
     if (mainCamera != null)
     {
         cameraControl = mainCamera.GetComponent <CameraFollow2D> ();
     }
     if (Boss != null)
     {
         bossControl          = Boss.GetComponent <BossScript> ();
         bossEnter            = Boss.GetComponent <MoveScript> ();
         bossCollider         = Boss.GetComponent <PolygonCollider2D> ();
         bossControl.enabled  = false;
         bossEnter.enabled    = false;
         bossCollider.enabled = false;
     }
     if (GUI != null)
     {
         guiScript = GUI.GetComponent <GUIScript> ();
     }
     entranceCountdown = -11;
 }
示例#12
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.tag == "Enemy")
        {
            Enemy script = collision.GetComponent <Enemy>();
            script.health -= damage;

            Destroy(gameObject);
        }
        if (collision.tag == "Tile")
        {
            Debug.Log(collision.GetComponent <Tile>().getColor().Equals(Color.gray));
            if (collision.GetComponent <Tile>().getColor().Equals(Color.gray))
            {
                Destroy(gameObject);
            }
        }

        if (collision.tag == "Boss")
        {
            BossScript script = collision.GetComponent <BossScript>();
            script.health -= damage;

            Destroy(gameObject);
        }
    }
示例#13
0
    public override void Initialize()
    {
        base.Initialize();
        cam    = CameraScript.Instance;
        ladder = LadderScript.Instance;
        player = PlayerController.Instance;
        boss   = BossScript.Instance;

        cam.transform.position    = new Vector3(0.0f, 0.0f, -10.0f);
        player.transform.position = new Vector3(-7.611201f, -6.845f, 0.0f);

        started     = false;
        cam.rising  = false;
        isDead      = false;
        bossStarted = false;
        ladder.Initialize(cam.deathBox.transform.position);
        lives             = 3;
        player.isAlone    = false;
        player.canControl = true;
        player.autoMove   = false;
        cam.FadeClear(1.0f);
        GameEngine.Instance.invisibleWall.SetActive(true);

        source = Camera.main.GetComponent <AudioSource>();
    }
示例#14
0
    public override void Initialize()
    {
        base.Initialize();
        _female_prefab = (Resources.Load("Prefabs/Female") as GameObject).GetComponent <Female>();
        cam            = CameraScript.Instance;
        player         = PlayerController.Instance;
        engine         = GameEngine.Instance;
        boss           = BossScript.Instance;

        cam.transform.position    = new Vector3(100.0f, 0.0f, -10.0f);
        cam.rising                = true;
        player.freeze             = false;
        player.transform.position = new Vector3(115.0f, 0.0f, 0.0f);
        cam.FadeClear(1.0f);
        player.canControl = false;
        StartCoroutine(DelayedGo());
        engine.lastGround.gameObject.SetActive(false);
        engine.TryAgain      = false;
        engine.PlayerGoFirst = false;
        engine.GoodEnding    = false;

        boss.PrepareFinale();

        cam_arrived     = false;
        player_arrived  = false;
        player_arrived2 = false;
        scene_started   = false;
        player.isAlone  = false;
        player.IsDead   = false;
    }
示例#15
0
 void Start()
 {
     LowEnemy         = LayerMask.GetMask("LowEnemy");
     BossLayer        = LayerMask.GetMask("Boss");
     EnemyLayer       = LayerMask.GetMask("Enemy");
     MageLayer        = LayerMask.GetMask("MageEnemy");
     RogueLayer       = LayerMask.GetMask("RogueEnemy");
     PlayerAnimator   = GetComponent <Animator>();
     playerRB         = GetComponent <Rigidbody2D>();
     footCollider     = GetComponent <BoxCollider2D>();
     EnemysPart0      = GameObject.Find("EnemysPart0");
     playerObject     = GameObject.Find("Player");
     bossScript       = GameObject.Find("Boss").GetComponent <BossScript>();
     respawnTransform = GameObject.Find("CheckPoint0").GetComponent <Transform>();
     AudioSource[] soundSources = GetComponents <AudioSource>();
     skillSound      = soundSources[0];
     jumpSound       = soundSources[1];
     dodgeSound      = soundSources[2];
     attackSound     = soundSources[3];
     takeDamageSound = soundSources[4];
     dieSound        = soundSources[5];
     crouchSound     = soundSources[8];
     shieldSound     = soundSources[6];
     gainDamageSound = soundSources[7];
     PlayerHealth    = PlayerMaxHealth;
     if (selectedControl == 2)
     {
         crouchCoolDownImage.fillAmount = 0;
     }
     skillCoolDownImage.fillAmount = 0;
 }
示例#16
0
 private void Start()
 {
     anim              = GetComponent <Animator>();
     spriteRenderer    = GetComponent <SpriteRenderer>();
     meleeAttackScript = GetComponent <MeleeAttackScript>();
     bossScript        = GetComponent <BossScript>();
 }
示例#17
0
    private void Awake()
    {
        bossScript = GetComponent <BossScript>();

        jumpState = new JumpAttackState(this);
        horState  = new SpikesHorAttackState(this);
        vertState = new SpikesVertAttackState(this);
    }
 // Start is called before the first frame update
 void Start()
 {
     rbody       = GetComponent <Rigidbody2D>();
     rocketImage = gameObject.GetComponent <Transform>().Find("Rocket_Image").gameObject;
     rocketTrail = gameObject.GetComponent <Transform>().Find("Rocket_Trail").gameObject;
     explosion   = gameObject.GetComponent <Transform>().Find("Explosion").gameObject;
     boss        = GameObject.FindWithTag("Boss").GetComponent <BossScript>();
 }
示例#19
0
    public void SetBossScript(Scene scene, LoadSceneMode mode)
    {
        SceneManager.sceneLoaded -= SetBossScript;
        var rootObject = scene.GetRootGameObjects()[0];

        boss = rootObject.GetComponentInChildren <BossScript>();
        boss.onFinishDeath += EndLevel;
    }
示例#20
0
 void Awake()
 {
     if (SceneManager.GetSceneByName("Boss").isLoaded)
     {
         boss       = GameObject.FindGameObjectWithTag("Boss"); // define player como a tag Player
         bossScript = boss.GetComponent <BossScript>();
     }
 }
示例#21
0
 override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     #region Getting Components
     player = GameObject.FindGameObjectWithTag("Player").transform;
     rb     = animator.GetComponent <Rigidbody2D>();
     boss   = animator.GetComponent <BossScript>();
     jump   = animator.GetComponent <BossJump>();
     #endregion
 }
示例#22
0
    void showBoss()
    {
        BossScript bossScript = (BossScript)boundaryMarker.GetComponent(typeof(BossScript));

        if (!bossScript.isDead)
        {
            bossScript.isActive = true;
        }
    }
示例#23
0
 // Start is called before the first frame update
 void Start()
 {
     ctrl_boss          = FindObjectOfType <BossScript>();
     ctrl_Player        = FindObjectOfType <CharacterController2D>();
     ctrl_enemy         = FindObjectOfType <EnemyMelee>();
     ctrl_ShootingEnemy = FindObjectOfType <ShootingEnemy>();
     ctrl_flierEnemy    = FindObjectOfType <FlierEnemy>();
     spriteRenderer     = GetComponent <SpriteRenderer>();
 }
示例#24
0
 private void OnTriggerStay(Collider other)
 {
     if (Input.GetKeyDown(KeyCode.F))
     {
         bs = GameObject.FindGameObjectWithTag("boss").GetComponentInChildren <BossScript>();
         bs.Revive();
         prompt.SetActive(false);
         gcs.GameEnded(true);
     }
 }
示例#25
0
    // Update is called once per frame
    void Update()
    {
        bossScript = GameObject.Find("Boss").GetComponent <BossScript>();

        if (bossScript.isRotating == true && isLaserSpawned == false)
        {
            fireLazor();

            isLaserSpawned = true;
        }
    }
示例#26
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else
     {
         Destroy(this);
     }
 }
示例#27
0
    // Use this for initialization
    void Start()
    {
        rigid         = GetComponent <Rigidbody2D>();
        spawnTranform = GameObject.Find("Spawn").transform;

        BossScript  = FindObjectOfType <BossScript>();
        gameManager = FindObjectOfType <GameManager>();

        playerAnimationControle = GetComponent <Animator>();
        render = GetComponent <SpriteRenderer>();
    }
示例#28
0
 private void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
     else
     {
         DontDestroyOnLoad(Instance);
     }
 }
示例#29
0
    void Start()
    {
        bossScript   = GetComponent <BossScript>();
        healthScript = GetComponent <HealthScript>();
        isAlive      = true;

        Instantiate(deadHand);
        deadHand.SetActive(false);

        rend       = GetComponent <SpriteRenderer>();
        startColor = rend.color;
    }
示例#30
0
    // Start is called before the first frame update

    void Awake()
    {
        cc2D = GetComponent <CircleCollider2D>();

        speed  = 10f;
        AudioS = GetComponent <AudioSource>();

        if (SceneManager.GetSceneByName("Boss").isLoaded)
        {
            boss       = GameObject.FindGameObjectWithTag("Boss"); // define player como a tag Player
            bossScript = boss.GetComponent <BossScript>();
        }
    }
    // Start is called before the first frame update
    void Start()
    {
        animator = GetComponent <Animator>();
        rigid    = GetComponent <Rigidbody2D>();
        boss     = GetComponent <BossScript>();
        render   = GetComponent <SpriteRenderer>();

        PlayerReference = GameObject.FindWithTag("Player").transform;

        boss.onFinishPresentation += StartFight;
        boss.onFinishFighting     += EndFight;
        distance = Camera.main.orthographicSize * 2.5f;
        fighting = false;
    }
示例#32
0
文件: Doctor.cs 项目: TStream/MiniPhD
 void OnCollisionEnter(Collision col)
 {
     if(col.gameObject.name == "BlueVirus")
     {
         bVirus = col.gameObject.GetComponent<BlueVirus>();
         if(bVirus.alive == true)
             stunned = true;
     }else if(col.gameObject.name == "GreenVirus")
     {
         gVirus = col.gameObject.GetComponent<GreenVirus>();
         if(gVirus.alive == true)
             stunned = true;
     }else if(col.gameObject.name == "RedVirus")
     {
         rVirus = col.gameObject.GetComponent<RedVirus>();
         if(rVirus.alive == true)
             stunned = true;
     }else if(col.gameObject.name == "Boss")
     {
         boss = col.gameObject.GetComponent<BossScript>();
         if(boss.alive == true)
             stunned = true;
     }
 }
示例#33
0
    public void SpawnBoss()
    {
        GameObject bossy = (GameObject)Instantiate(boss, new Vector3(0, 0, 0), transform.rotation);
        endBoss = bossy.GetComponent<BossScript>();
        endBoss.manager = this;
        bossSpawn = true;

        bossBirthTime = endBoss.birthTime;

        foreach (CellScript cell in infectedList)
        {
            cell.targetLocation = bossy.transform;
            cell.beAbsorbed = true;
        }

        cameraScript.SetPlayerDist(2);

        audioSource.clip = bossBGM;
        audioSource.Play();
    }
示例#34
0
	void Awake()
	{
		i = this;
	}