Example #1
0
    public virtual void Start()
    {
        animations = new PlayerAnimator();
#endif
        move        = new PlayerMove(transform, animations);
        rotate      = new PlayerRotate(transform);
        fall        = new PlayerFall(transform, animations);
        respawner   = new PlayerRespawn(animations, player_effects[1]);
        platforming = new PlayerSetMovements(transform, gameObject, move, rotate, fall, animations, respawner, player_effects[0]);
        health_bar  = new PlayerHP(health, transform, respawner);


        move.SetMovementSpeed((float)movement_speed);
        rotate.SetRotationSpeed((float)rotation_speed);
        rotate.SetIceRotationSpeed((float)ice_rotation_speed);
        fall.SetFallSpeed((float)fall_speed);
        platforming.SetMovementSpeed((float)movement_speed);
        platforming.SetIceMovementSpeed((float)ice_movement_speed);
        health_bar.SetHealthBarInVisibile();
#if BOLT
        state.SetTransforms(state.Transform, transform);

        state.SetAnimator(GetComponent <Animator>());
        state.Animator.applyRootMotion = entity.isOwner;
        state.Animator.SetInteger("Type", 0);         //Tiger = 0.
        //state.Stand = true;
        state.Animator.SetBool("Stand", true);

        //Player colors

        string player_network_id = entity.networkId.ToString();
        player_network_id = player_network_id.Substring(Math.Max(0, player_network_id.Length - 2));
        player_network_id = player_network_id[0].ToString();
//		if (entity.isOwner) {
//			if (player_network_id == "1") {
//				state.CubeColor = new Color(255, 0, 0);
//			}
//			else if (player_network_id == "2") {
//				state.CubeColor = new Color(0, 255, 0);
//			}
//				else {
//				state.CubeColor = new Color(255, 255, 255);
//			}
//		}
//		state.AddCallback("CubeColor", ColorChanged);
#endif
    }
Example #2
0
    public override void _Ready()
    {
        _collision_layer = 1;
        ((Area)FindNode("MeleAttackArea")).SetCollisionMaskBit(2, true);      // monitor only enemies
        AddToGroup("player");

        var st_ground = new PlayerGround();
        var st_air    = new PlayerAir();
        var st_skill1 = new PlayerSkill1();
        var st_skill3 = new PlayerSkill3();

        var tr_jump   = new PlayerJump(st_air);
        var tr_fall   = new PlayerFall(st_air);
        var tr_land   = new PlayerLand(st_ground);
        var tr_skill1 = new PlayerActivateSkill(st_skill1, 0, GD.KEY_Z);
        var tr_skill3 = new PlayerActivateSkill(st_skill3, 2, GD.KEY_C);

        st_ground.AddTransition(tr_jump);
        st_ground.AddTransition(tr_fall);
        st_ground.AddTransition(tr_skill1);
        st_ground.AddTransition(tr_skill3);
        st_air.AddTransition(tr_land);
        st_air.AddTransition(tr_skill1);
        st_air.AddTransition(tr_skill3);

        st_skill1.AddTransition(new FromOneShotAnim(st_ground, "skills"));
        st_skill3.AddTransition(new FromOneShotAnim(st_ground, "skills"));

        _fsm = new FSM(this, st_ground);

        // Attributes
        Attributes.Level               = 0;
        Attributes.RunSpeed            = 8;
        Attributes.JumpHeight          = 4;
        Attributes.MaxHealth           = 100;
        Attributes.Health              = Attributes.MaxHealth;
        Attributes.Damage              = 10;
        Attributes.CritChance          = 0.1f;
        Attributes.Experience          = 0.0f;
        Attributes.NextLevelExperience = 100;
    }
Example #3
0
 void OnPlayerFall(PlayerFall e)
 {
     fallenPlayer = e.fallenPlayer;
     SetStatus(TaskStatus.Success);
 }
Example #4
0
 void RoundLoss(PlayerFall e)
 {
     playerRoundLosses[e.fallenPlayer.playerNum - 1] += 1;
 }
Example #5
0
 public void Colliding(GameObject o)
 {
     PlayerFall?.Invoke(o);
     StartCoroutine(StandingUp());
 }
Example #6
0
 void OnPlayerFall(PlayerFall e)
 {
     StopListeningForInput();
 }
 void OnPlayerFall(PlayerFall e)
 {
     SetStatus(TaskStatus.Aborted);
 }