Example #1
0
    private void OnTriggerEnter2D(Collider2D col)
    {
        ILaser laser = col.gameObject.GetComponent <ILaser>();

        if (laser == null)
        {
            return;
        }

        float degree = 0;

        switch (laser.GetCurrentDir())
        {
        case Direction.UP:
            degree = 180;
            break;

        case Direction.Right:
            degree = 90;
            break;

        case Direction.Down:
            degree = 0;
            break;

        case Direction.Left:
            degree = -90;
            break;
        }

        EffectManager.Instance.CallEffect(col.transform.position, degree, 1);

        laser.OnCollisionWall(ObjectType.Wall);
    }
Example #2
0
        private void OnTriggerEnter2D(Collider2D col)
        {
            ILaser laser = col.gameObject.GetComponent <ILaser>();

            if (laser != null)
            {
                Direction cuDir   = laser.GetCurrentDir();
                Direction nextDir = ChangeLaserDir(cuDir);
                laser.SetCurrentLaserDir(nextDir);
                col.gameObject.transform.position = transform.position;
                AddReflectDamage(1);

                float angle = EffectAngle(cuDir, nextDir);
                EffectManager.Instance.CallEffect(col.transform.position, angle, 0);
            }
        }