Пример #1
0
    public void Set(Vector2 position, float time, Vector2 direction, float damage, float speed = 10)
    {
        cameraController = FindObjectOfType <CameraController>();
        audioSource      = GetComponent <AudioSource>();
        trail            = GetComponent <ParticleSystem>();
        shockwave        = transform.Find("ShockwaveSpikes").GetComponent <ParticleSystem>();
        damageContainer  = GetComponent <DamageContainer>();
        collider         = GetComponentInChildren <Collider2D>();
        terrainMask      = 1 << LayerMask.NameToLayer("Terrain");
        damageContainer.SetDamageCall(() => damage);

        this.speed         = speed;
        this.timer         = time;
        this.direction     = direction;
        transform.position = position;

        RaycastHit2D hit = GetGroundHit();

        if (hit)
        {
            transform.position = hit.point;
        }

        trail.Play();
        shockwave.Play();
        audioSource.clip = soundLoop;
        audioSource.loop = true;
        audioSource.Play();
    }
 public void Set(Vector3 position, float damage)
 {
     damageContainer        = GetComponent <DamageContainer>();
     spriteRenderer         = GetComponent <SpriteRenderer>();
     circleCollider         = GetComponent <CircleCollider2D>();
     animator               = GetComponent <Animator>();
     circleCollider.enabled = false;
     damageContainer.SetDamageCall(() => damage);
     DisableCollider();
 }
Пример #3
0
 void Start()
 {
     health = maxHealth;
     damageContainer.SetDamageCall(() => 0);
 }