Esempio n. 1
0
    void Start()
    {
        anim = GetComponent <Animator>();

        cc           = GetComponent <CircleCollider2D>();
        player       = GameObject.FindGameObjectWithTag("Player");
        stats        = player.GetComponent <PlayerStats>();
        baseDamage   = player.GetComponentInChildren <FireWall>().baseDamage;
        direction    = ((Vector2)gameObject.transform.position - (Vector2)player.transform.position).normalized;
        OGController = transform.root.gameObject.GetComponent <FireWallController>();
        ps           = GetComponent <ParticleSystem>();
        if (OGController.currentFires == OGController.maxFires)
        {
            OGController.finalFire = gameObject;
        }
        var xFlip = Random.Range(0f, 1f);

        if (xFlip < 0.5f)
        {
            gameObject.transform.rotation = new Quaternion(0f, 180f, 0f, 0F);
        }
        else
        {
            gameObject.transform.rotation = new Quaternion(0f, 0f, 0f, 0F);
        }
        var varSpeed = Random.Range(0.5f, 1f);

        anim.speed = varSpeed;

        StartCoroutine(FireWallTimeline());
        InvokeRepeating("StandingInFire", 0f, 0.5f);
    }
Esempio n. 2
0
    void OnCollisionEnter(Collision info)
    {
        FireWallController FireCon = info.collider.gameObject.GetComponent <FireWallController>();

        if (FireCon)
        {
            FireCon.Health--;
        }
        HealthController HealthCon = info.collider.gameObject.GetComponent <HealthController>();

        if (HealthCon)
        {
            HealthCon.TakeDamage(Damage);
        }

        if (info.collider.gameObject.name == "LasershotTarget")
        {
            GameObject.FindGameObjectWithTag("Player").transform.position = info.collider.gameObject.transform.position - new Vector3(1.0f, 0.0f, 0.0f);
        }

        Destroy(gameObject);
    }
Esempio n. 3
0
 // Start is called before the first frame update
 void Start()
 {
     sharedInstance = this;
     rb2d           = GetComponent <Rigidbody2D>();
 }