示例#1
0
 // Start is called before the first frame update
 void Start()
 {
     pc = GetComponent <PlatformingCharacter>();
     // pc.OnJump += Pc_OnJump;  // I dont think this contributes to a good playstyle, the fact taht being in air interupts recovery is quite good enough.
     pc.OnWallJump += Pc_OnWallJump;
     currentstamina = maxStamina;
 }
示例#2
0
 [ClientRpc(channel = 2)] private void RpcStomp(double time, Vector2 at)
 {
     if (time > lastBoost)
     {
         PlatformingCharacter.Resimulate((float)(NetworkTime.time - time), at, stomp: true);
     }
 }
示例#3
0
 void Start()
 {
     Character          = GetComponent <PlatformingCharacter>();
     Character.OnJump  += PlatformingCharacter_OnJump;
     Character.OnStomp += (o) => PlatformingCharacter_OnJump();
     // Health = GetComponent<Health>();
     // Health.OnHurt += Health_OnHurt;
     // Health.OnKill += Health_OnKill;
 }
示例#4
0
 void Reset(PlatformingCharacter player)
 {
     if (next > Time.timeSinceLevelLoad)
     {
         return;
     }
     FindObjectOfType <PartyStreamer>().Pop(player.transform.position);
     player.transform.position = transform.position;
     next = Time.timeSinceLevelLoad + .1f;
 }
示例#5
0
 void Start()
 {
     Character             = GetComponent <PlatformingCharacter>();
     Character.OnJump     += PlatformingCharacter_OnJump;
     Character.OnStomp    += (o) => PlatformingCharacter_OnJump();
     Character.OnWallJump += PlatformingCharacter_OnJump;
     GetComponent <DoubleJump>().OnDoubleJump += PlatformingAnimator_OnDoubleJump;
     // Health = GetComponent<Health>();
     // Health.OnHurt += Health_OnHurt;
     // Health.OnKill += Health_OnKill;
 }
示例#6
0
 public void Respawn(PlatformingCharacter player)
 {
     if (player.GetComponent <NetworkIdentity>() == null)
     {
         Reset(player);
     }
     else if (player.GetComponent <NetworkIdentity>().isLocalPlayer)
     {
         Reset(player);
     }
 }
示例#7
0
    public void Stomp(PlatformingCharacter source)
    {
        hits++;

        StopCoroutine(Coroutine);
        if (hits >= 3)
        {
            Coroutine = StartCoroutine(KillMe());
        }
        else
        {
            Coroutine = StartCoroutine(Routine(hits));
        }
    }
示例#8
0
    IEnumerator Trigger(PlatformingCharacter player)
    {
        FindObjectOfType <Checkpoint>().Respawn(player);
        var camera   = FindObjectOfType <CameraFollow>();
        var renderer = player.GetComponentInChildren <SpriteRenderer>();

        camera.enabled   = false;
        player.enabled   = false;
        renderer.enabled = false;
        yield return(new WaitForSeconds(.5f));

        camera.enabled   = true;
        renderer.enabled = true;
        player.enabled   = true;
    }
示例#9
0
    IEnumerator DaLoop()
    {
        Controls            = GetComponent <PlatformingCharacter>();
        InputToken          = new InputToken();
        Controls.InputToken = InputToken;
        int direction = Controls.Forward;

        InputToken.Direction = new Vector2(direction, 0f);
        yield return(new WaitForSeconds(.1f));

        GetComponent <SpriteRenderer>().enabled = true;
        Controls.enabled   = true;
        Controls.HMomentum = 0f;
        Controls.VMomentum = 0f;
        GetComponentsInChildren <Collider2D>().ForEach(c => c.enabled = true);

MoveForward:
        for (; ;)
        {
            InputToken.Direction = new Vector2(direction, 0f);
            if (Controls.TouchingWall && Controls.TouchingWallDirection == direction)
            {
                goto Turn;
            }
            if (turnAtLedges && Controls.Grounded && Controls.OnEdge)
            {
                goto Turn;
            }
            yield return(new WaitForFixedUpdate());
        }
Turn:
        direction            = -direction;
        InputToken.Direction = new Vector2(direction, 0f);
        yield return(new WaitForSeconds(.1f));

        goto MoveForward;
    }
示例#10
0
 private void PC_OnStomp(PlatformingCharacter obj)
 {
     denyFrames = 10;
     available  = true;
 }
示例#11
0
 void Start()
 {
     PC          = GetComponent <PlatformingCharacter>();
     PC.OnStomp += PC_OnStomp;
 }
示例#12
0
 private void Start()
 {
     platformingCharacter = GetComponent <PlatformingCharacter>();
     animator             = GetComponent <Animator>();
 }
示例#13
0
 private void PlatformingCharacter_OnStomp(PlatformingCharacter obj)
 {
     lastBoost = NetworkTime.time;
     obj.GetComponent <NetworkControls>().CmdStomp(NetworkTime.time, obj.transform.position);
 }