Exemplo n.º 1
0
        public override void CmdCastSpell()
        {
            TargetTriggerAttackAnimation("Attack2");

            if (Physics.SphereCast(aimPosition, HitRadius, aimForward, out RaycastHit hit, Range, LayerMasks.ballLayer | LayerMasks.propsLayer))
            {
                Vector3 pullDirection = aimPosition - hit.transform.position;
                Vector3 pullForce     = pullDirection.normalized * force;
                if (hit.rigidbody != null)
                {
                    hit.rigidbody.AddForce(pullForce, ForceMode.Impulse);
                    GameObject      vfx            = Instantiate(forcePullHitVFX, hit.point, Quaternion.LookRotation(hit.normal));
                    VFXFollowObject followPosition = vfx.GetComponent <VFXFollowObject>();
                    if (followPosition != null)
                    {
                        followPosition.FollowTransform = hit.transform;
                    }
                    else
                    {
                        Debug.LogError("No FollowPosition script attached to ForcePull vfx");
                    }
                    NetworkServer.Spawn(vfx);
                    StartCoroutine(DestroyVFX(vfx, vfxDuration));
                }
            }

            CreateLine(aimPosition, hit.point);
        }
Exemplo n.º 2
0
        public override void CmdCastSpell()
        {
            TargetTriggerAttackAnimation("Attack2");

            if (Physics.SphereCast(aimPosition, HitRadius, aimForward, out RaycastHit hit, Range, LayerMasks.ballLayer | LayerMasks.propsLayer))
            {
                Resizable resizable = hit.transform.GetComponent <Resizable>();
                if (resizable != null)
                {
                    resizable.ApplySpell(new SpellStackInfo(Spells.Minimize, modifier, duration));

                    if (minimizeHitVFX != null)
                    {
                        GameObject      vfx            = Instantiate(minimizeHitVFX, hit.transform.position, Quaternion.identity);
                        VFXFollowObject followPosition = vfx.GetComponent <VFXFollowObject>();
                        if (followPosition != null)
                        {
                            followPosition.FollowTransform = hit.transform;
                        }
                        else
                        {
                            Debug.LogError("No FollowPosition script attached to Minimize vfx");
                        }
                        NetworkServer.Spawn(vfx);
                        StartCoroutine(DestroyVFX(vfx, vfxDuration));
                    }
                }
            }

            CreateLine(aimPosition, hit.point);
        }
Exemplo n.º 3
0
        public override void CmdCastSpell()
        {
            TargetTriggerAttackAnimation("Attack2");

            if (Physics.SphereCast(aimPosition, HitRadius, aimForward, out RaycastHit hit, Range, LayerMasks.ballLayer | LayerMasks.propsLayer))
            {
                if (hit.rigidbody != null && !hit.rigidbody.isKinematic)
                {
                    hit.rigidbody.AddForce(Vector3.up * upwardsForce, ForceMode.Impulse);

                    if (hit.rigidbody.useGravity == true)
                    {
                        hit.rigidbody.useGravity = false;
                        StartCoroutine(EnableGravity(hit.rigidbody));
                        GameObject      vfx            = Instantiate(forceFlyHitVFX, hit.point, Quaternion.LookRotation(hit.normal));
                        VFXFollowObject followPosition = vfx.GetComponent <VFXFollowObject>();
                        if (followPosition != null)
                        {
                            followPosition.FollowTransform = hit.transform;
                        }
                        else
                        {
                            Debug.LogError("No FollowPosition script attached to Force Fly vfx");
                        }

                        NetworkServer.Spawn(vfx);
                        StartCoroutine(DestroyVFX(vfx, durationInSeconds));
                    }
                }
            }

            CreateLine(aimPosition, hit.point);
        }