Exemplo n.º 1
0
    public void HurtPlayer(HurtPlayer caller, float damageToTake)
    {
        if (!playerCanTakeDomage)
        {
            caller.gameObject.SetActive(false);
            if (damageToTake > 0)
            {
                Instantiate(deathSplosion, caller.transform.position, caller.transform.rotation);
            }
            return;
        }
        healthCount -= damageToTake;
        if (healthCount >= maxHealth)
        {
            StartCoroutine(PlayerCantBeDomagedFor10Seconds());
        }

        HealthBarController.instance.LerpToNewHealthValue(healthCount / maxHealth);
        if (healthCount <= 0 && !respawning)
        {
            Respawn();
            respawning = true;
        }
        // UpdateHeartMeter();
    }
Exemplo n.º 2
0
 void Awake()
 {
     instance       = this;
     this.isBurning = true;
     gameObject.SetActive(true);
     burn--;
 }
Exemplo n.º 3
0
    void Start()
    {
        Player.transform.position = Spawn.transform.position;

        fire = fireGroup.GetComponentInParent <HurtPlayer> ().GetInstance();

        minDragDistance = Screen.height * 15 / 100;         //15% of screen height
        endPos          = transform.position;
        aStar           = GameObject.FindGameObjectWithTag("aStar");
        grid            = aStar.GetComponent <Grid> ().GetInstance();
        bubb            = GameObject.FindObjectOfType <DeathBubble> ().GetInstance();


        arUnwalkable = GameObject.FindGameObjectsWithTag("Unwalkable");

        for (int i = 0; i < arUnwalkable.Length; i++)
        {
            currLPos = new Vector3(arUnwalkable [i].transform.position.x,
                                   arUnwalkable [i].transform.position.y,
                                   arUnwalkable [i].transform.position.z);
            unwalkablePos.Add(currLPos);
        }
        posArr = unwalkablePos.ToArray();

        gm = GameObject.FindGameObjectWithTag("GM").GetComponent <GameManager> ().GetInstance();

        sprrend = GetComponentInChildren <SpriteRenderer> () as SpriteRenderer;

        InitEnemies();
    }
Exemplo n.º 4
0
    void Start()
    {
        canMove = true;

        //SpawnPoint
        //respawnPosition = transform.position;

        theLevelManager           = FindObjectOfType <LevelManager>();
        lastPositionScript        = FindObjectOfType <LastPosition>();
        evolveScript              = FindObjectOfType <Evolve>();
        tvPlayer                  = FindObjectOfType <PlayerController>();
        transformationCloudScript = FindObjectOfType <TransformationCloud>();
        hurtPlayerScript          = FindObjectOfType <HurtPlayer>();


        //Assign variables
        rb2d = gameObject.GetComponent <Rigidbody2D>();
        anim = gameObject.GetComponent <Animator>();

        //Start with full health
        currentHealth = maxHealth;

        //tvPlayer = FindObjectOfType<PlayerController>();

        transform.position = lastPositionScript.pos;
    }
Exemplo n.º 5
0
    public void Setup() //performs the same actions as MonoBehaviour's Start() function
    {
        playerController  = FindObjectOfType <PlayerController>();
        hurtPlayer        = FindObjectOfType <HurtPlayer>();
        characterSelector = FindObjectOfType <CharacterSelector>();

        storedMoveSpeed = playerController.GetMoveSpeed(); //locally stores the value of the player's current move speed before it gets altered
    }
Exemplo n.º 6
0
 void Start()
 {
     enemyDmg       = FindObjectOfType <HurtPlayer>();
     slime          = FindObjectOfType <EnemyStats>();
     playerStats    = FindObjectOfType <PlayerStats>();
     enemyHpMax     = slime.enemyMaxHp;
     enemyHpCurrent = enemyHpMax;
     timer          = timeBeforeLevel;
 }
Exemplo n.º 7
0
    void Start()
    {
        player = GameObject.FindGameObjectWithTag("Player");
        playerMovementTopDown = player.GetComponent <PlayerMovementTopDown>();
        hurtPlayer            = GetComponent <HurtPlayer>();

        agent = GetComponent <NavMeshAgent>();

        SetupAnimator();
        SetupStateHashes();

        // starting state
        SetStartingState();
    }
Exemplo n.º 8
0
    // Use this for initialization
    void Start()
    {
        rb         = GetComponent <Rigidbody2D>();
        player     = PlayerController2D.Instance.transform;
        anim       = GetComponent <Animator>();
        hurtPlayer = GetComponent <HurtPlayer>();

        timeBetweenMoveCounter = Random.Range(timeBetweenMove * 0.75f, timeBetweenMove * 1.25f);
        timeToMoveCounter      = Random.Range(timeToMove * 0.75f, timeToMove * 1.25f);

        if (walkZone != null)
        {
            minWalkPoint = walkZone.bounds.min;
            maxWalkPoint = walkZone.bounds.max;
            hasWalkZone  = true;
        }
    }
    void OnTriggerEnter2D(Collider2D other)
    {
        if (other.gameObject.CompareTag(DEATHBOX_TAG))
        {
            levelManager.RespawnPlayer();
        }

        Coin coin = other.GetComponent <Coin>();

        if (coin != null)
        {
            levelManager.AddCoins(coin.coinAmount);
            coin.gameObject.SetActive(false);
        }

        Heart heart = other.GetComponent <Heart>();

        if (heart != null)
        {
            levelManager.AddHealth(heart.healthAmount);
            heart.gameObject.SetActive(false);
        }

        HurtPlayer hurt = other.GetComponent <HurtPlayer>();

        if (hurt != null && hurt.IsActive)
        {
            levelManager.DamagePlayer(hurt.damageAmount);
        }

        LevelEnd end = other.GetComponent <LevelEnd>();

        if (end != null)
        {
            end.Trigger();
        }

        Checkpoint check = other.GetComponent <Checkpoint>();

        if (check != null)
        {
            check.Trigger();
            respawnPoint = check.transform;
            checkpointAudio.Play();
        }
    }
Exemplo n.º 10
0
 // Use this for initialization
 void Start()
 {
     hurtPl = FindObjectOfType <HurtPlayer> ();
 }
Exemplo n.º 11
0
 // Use this for initialization
 void Start()
 {
     shotCounter = waitBetweenShots;
     enemyHealth = GetComponent <EnemyHealthManager> ();
     hurtPlayer  = GetComponent <HurtPlayer> ();
 }
Exemplo n.º 12
0
 public void Setup() //performs the same actions as MonoBehaviour's Start() function
 {
     hurtPlayer        = FindObjectOfType <HurtPlayer>();
     characterSelector = FindObjectOfType <CharacterSelector>();
 }