示例#1
0
    /// <summary>
    /// c'est ici qu'on prépare le jump de base !
    /// </summary>
    /// <param name="dir"></param>
    public void PrepareAndJump(Vector3 dir)
    {
        worldCollision.HasJustJump();                             //cooldown des worldCollision
        coolDownJump.StartCoolDown();                             //le coolDown normal du jump
        playerAirJump.CoolDownBeforeFirstAirJump.StartCoolDown(); //démar le air jump cool Down

        //PlayerConnected.Instance.setVibrationPlayer(playerController.IdPlayer, onJump); //set vibration de saut
        hasJumpAndFlying = true; //on vient de sauter ! tant qu'on retombe pas, on est vrai

        Debug.DrawRay(transform.position, dir, Color.red, 5f);
        GameObject particle = ObjectsPooler.Instance.SpawnFromPool(GameData.PoolTag.ParticleBump, transform.position, Quaternion.identity, ObjectsPooler.Instance.transform);

        particle.transform.rotation = QuaternionExt.LookAtDir(dir * -1);

        //SoundManager.Instance.PlaySound("Play_sfx3D" + transform.GetInstanceID());
        SoundManager.Instance.PlaySound("Play_Jump");
        animController.AnimJump();
        //externalForce.SetBigMass();   //set sa propre mass big !
        //playerController.PlayersManager.Jump(playerController.IdPlayer);
    }
示例#2
0
    /// <summary>
    /// jump ! dans la direction donné
    /// </summary>
    public bool TryToAirJump(Vector3 dir)
    {
        if (!CanJump())
        {
            return(false);
        }

        //PlayerConnected.Instance.setVibrationPlayer(playerController.IdPlayer, onAirJump); //set vibration de saut

        Debug.Log("air jump !");
        Debug.DrawRay(transform.position, -Vector3.up, Color.red, 5f);
        GameObject particle = ObjectsPooler.Instance.SpawnFromPool(GameData.PoolTag.ParticleBump, transform.position, Quaternion.identity, ObjectsPooler.Instance.transform);

        particle.transform.rotation = QuaternionExt.LookAtDir(-Vector3.up);

        currentAirJump++;

        coolDownBetween2AirJump.StartCoolDown();
        playerJump.Jump(dir, true, airJumpForce);
        return(true);
    }
示例#3
0
    /// <summary>
    /// ici n'active pas si la distance des 2 joueurs est trop courte
    /// par rapport aux nombre de particule dans la chaine
    /// </summary>
    /// <returns></returns>
    private bool CheckDistanceAndNumberParticle()
    {
        //int numberParticle = ropeHandler.ParticleInRope;
        float distance = 0;
        int   numberParticleFromPlayerToPivot = 0;

        pointPivot = Vector3.zero;
        bool onRope = false;

        ropeHandler.GetPivotPoint(playerController.IdPlayer, angleDifferenceMarginForPivotPoint, marginAngleConsideredAsEqual, out distance, out numberParticleFromPlayerToPivot, out pointPivot, out onRope);

//DebugExtension.DebugWireSphere(pointPivot, Color.magenta, 1f, 2f);
//Debug.Log("distance: " + distance);
//Debug.Log("number particle: " + numberParticleFromPlayerToPivot);

        //Debug.Log("numberParticle: " + numberParticle + ", distance: " + distance);
        if (IsOnRightDist(numberParticleFromPlayerToPivot, distance))
        {
            //ici on est dans la bonne distance
            //Debug.Log("ici OK");
            if (onRope)
            {
                GameObject particle = ObjectsPooler.Instance.SpawnFromPool(GameData.PoolTag.ParticleRopeTense, pointPivot, Quaternion.identity, ObjectsPooler.Instance.transform);
                particle.transform.rotation = QuaternionExt.LookAtDir(QuaternionExt.CrossProduct(pointPivot - transform.position, Vector3.forward) * -1);
            }

            //MessageBox.Show("Something happened. Attach the debugger, add a breakpoint to the line after this one, then press OK.");
            //"does nothing".ToString(); // place breakpoint here
            //Debug.Break();
            return(true);
        }
        //Debug.Log("ici PAS OK");
        //MessageBox.Show("Something happened. Attach the debugger, add a breakpoint to the line after this one, then press OK.");
        //"does nothing".ToString(); // place breakpoint here
        //Debug.Break();
        //ici dans la mauvaise distance
        return(false);
    }