示例#1
0
    public override void OnEvent(AudioStartEvent evnt)
    {
        switch (evnt.AudioID)
        {
        case 0:
            sautAudio.set3DAttributes(FMODUnity.RuntimeUtils.To3DAttributes(evnt.Position));
            sautAudio.start();

            GameObject go = Instantiate(jumpParticulePrefab, this.feetPosition.position, Quaternion.identity);
            //go.transform.SetParent(this.transform);
            go.transform.rotation = Quaternion.AngleAxis(-90, Vector3.right);
            Destroy(go, 1f);
            break;

        case 1:
            /////Son
            launchSeedAudio.set3DAttributes(FMODUnity.RuntimeUtils.To3DAttributes(transform.position));
            launchSeedAudio.start();
            /////Son
            break;

        case 2:
            /////Son
            launchAxeAudio.set3DAttributes(FMODUnity.RuntimeUtils.To3DAttributes(transform.position));
            launchAxeAudio.start();
            /////Son
            break;

        case 3:
            doubleSaut.set3DAttributes(FMODUnity.RuntimeUtils.To3DAttributes(evnt.Position));
            doubleSaut.start();

            GameObject gogo = Instantiate(jumpParticulePrefab, this.feetPosition.position, Quaternion.identity);
            //go.transform.SetParent(this.transform);
            gogo.transform.rotation = Quaternion.AngleAxis(-90, Vector3.right);
            Destroy(gogo, 1f);
            break;

        case 4:
            colBalleOther.set3DAttributes(FMODUnity.RuntimeUtils.To3DAttributes(evnt.Position));
            colBalleOther.start();
            break;
        }
    }
示例#2
0
    public void UpdateDoubleJump()
    {
        if (!this.grounded && !this.doubleJumping)
        {
            this.jumping       = true;
            this.doubleJumping = true;


            this.jumpTimer       = 0.0f;
            this.doubleJumpTimer = 0.0f;

            this.plateformeMouvanteDir = Vector3.zero;

            var evnt = AudioStartEvent.Create(entity);
            evnt.Position = transform.position;
            evnt.AudioID  = 3;
            evnt.Send();
        }
    }
示例#3
0
    IEnumerator LaunchSeedTrueFalse()
    {
        state.LaunchSeed = true;
        yield return(new WaitForSeconds(0.15f));

        {
            Seed s = BoltNetwork.Instantiate(BoltPrefabs.Seed, this.myHand.position + this.transform.forward + Vector3.up, Quaternion.identity).GetComponent <Seed>();
            s.Init(this.myTeam, this, this.transform.rotation, true, entity, state.MyColor, this.currentDir);
            s.InitVelocity(this.forceLaunch, this.dirLaunch);

            this.seedReadyImage.color = Color.red;

            var evnt = AudioStartEvent.Create(entity);
            evnt.Position = transform.position;
            evnt.AudioID  = 1;
            evnt.Send();
        }

        state.LaunchSeed = false;
        yield break;
    }
示例#4
0
    public void AddForce(Vector3 dir, float force)
    {
        dir = dir.normalized;

        dir.y += 0.1f;

        this.direction = dir * force;
        StartCoroutine(SmoothForceDown());

        if (entity.IsOwner)
        {
            /////Son
            colBalleMe.start();
            /////Son
        }
        else
        {
            var evnt = AudioStartEvent.Create(entity, EntityTargets.EveryoneExceptOwner);
            evnt.Position = transform.position;
            evnt.AudioID  = 4;
            evnt.Send();
        }
    }
示例#5
0
    public void FusRoDa()
    {
        this.IsFusRoDah = true;

        state.FusRoDa = true;

        var evntAudio = AudioStartEvent.Create(entity);

        evntAudio.Position = transform.position;
        evntAudio.AudioID  = 2;
        evntAudio.Send();

        switch (mode)
        {
        case FusRoDaMode.Cone:
            Vector3 position  = this.startPointFus.position + (this.cameraRef.forward * (this.distanceCheck / 2));
            Vector3 direction = this.CameraRef.rotation * Vector3.forward;

            Collider[] guardianColliders = Physics.OverlapSphere(position, this.fusDetectionRadius, this.fusRoDahLayerMask);

            if (guardianColliders.Length > 0)
            {
                foreach (var guard in guardianColliders)
                {
                    float distance = Vector3.Distance(this.transform.position, guard.transform.position);
                    float angle    = Vector3.Angle(this.transform.forward, guard.transform.position - this.transform.position);

                    if (angle <= this.angleMaxToCheckCone && distance <= this.distanceCheck)
                    {
                        if (!Physics.Raycast(this.transform.position, guard.transform.position - this.transform.position,
                                             distance, ~this.fusIgnoreLayerMask))
                        {
                            float force = this.forcePush;
                            force = force * (1 - ((Vector3.Distance(this.transform.position, guard.transform.position)) / this.distanceCheck) / this.diviseurDistance);


                            Guardian guardian = guard.GetComponent <Guardian>();
                            if (guardian != null && guardian != this)
                            {
                                guardian.SetStun(direction.normalized, force, entity);
                            }
                        }
                    }
                }
            }

            StartCoroutine(CoolDownFus());
            break;

        case FusRoDaMode.Laser:
            this.pointStartLaser.rotation    = cameraRef.rotation;
            this.pointEndLaser.localPosition = new Vector3(this.pointEndLaser.localPosition.x, this.pointEndLaser.localPosition.y, this.distanceCheck);

            Collider[] laserCol = Physics.OverlapCapsule(this.pointStartLaser.position, this.pointEndLaser.position,
                                                         this.fusDetectionRadius, this.fusRoDahLayerMask);

            Vector3 dir = this.cameraRef.rotation * Vector3.forward;

            if (laserCol.Length > 0)
            {
                foreach (var guard in laserCol)
                {
                    float distance = Vector3.Distance(this.startPointFus.position, guard.transform.position);
                    //float angle = Vector3.Angle(this.transform.forward, guard.transform.position - this.transform.position);

                    if (distance <= this.distanceCheck)
                    {
                        if (!Physics.Raycast(this.startPointFus.position, guard.transform.position - this.transform.position,
                                             distance, ~this.fusIgnoreLayerMask))
                        {
                            float force = this.forcePush;
                            force = force * (1 - ((Vector3.Distance(this.startPointFus.position, guard.transform.position)) / this.distanceCheck) / this.diviseurDistance);

                            Guardian guardian = guard.GetComponent <Guardian>();
                            if (guardian != null && guardian != this)
                            {
                                if (!guardian.IsDie && !guardian.IsStuned && !guardian.IsInvinsible)
                                {
                                    guardian.SetStun(dir.normalized, force, entity);
                                }
                            }
                        }
                    }
                }
            }
            StartCoroutine(CoolDownFus());
            break;
        }

        var evnt = FusRoDaFBEvent.Create(entity);

        evnt.Rotation = this.cameraRef.rotation;
        evnt.Send();
    }