Exemple #1
0
        /// <summary>
        /// Reads a format from the reader and jumps past the object
        /// </summary>
        /// <param name="reader">Reader.</param>
        private static void JumpObject(BinaryReader reader)
        {
            byte         format = reader.ReadByte();
            JumpDelegate del    = JumpTable [format];

            del(format, reader);
        }
    //
    public void SubscribeMethod(string AchieveType, int Id)
    {
        switch (AchieveType)
        {
        case "Jump":

            if (playData.achievements[Id].State == false)
            {
                JumpEvent += new JumpDelegate(JumpMethod);
                JumpBool   = true;
                JumpId     = Id;
                JumpTarget = playData.achievements[Id].Target;
            }
            break;

        case "Level":
            if (playData.achievements[Id].State == false)
            {
                LevelEvent += new LevelDelegate(LevelMethod);
                LevelBool   = true;
                LevelId     = Id;
                playData.achievements[LevelId].Done = playData.level;
                LevelTarget = playData.achievements[Id].Target;
            }
            break;

        case "Attack":
            if (playData.achievements[Id].State == false)
            {
                AttackEvent += new AttackDelegate(AttackMethod);
                AttackBool   = true;
                AttackId     = Id;
                AttackTarget = playData.achievements[Id].Target;
            }
            break;

        case "Die":
            if (playData.achievements[Id].State == false)
            {
                DieEvent += new DieDelegate(DieMethod);
                DieBool   = true;
                DieId     = Id;
                DieTarget = playData.achievements[Id].Target;
            }
            break;

        case "Kill":
            if (playData.achievements[Id].State == false)
            {
                KillEvent += new KillDelegate(KillMethod);
                KillBool   = true;
                KillId     = Id;
                KillTarget = playData.achievements[Id].Target;
            }
            break;
        }
    }
Exemple #3
0
    protected override void Setup()
    {
        base.Setup();
        anim = GetComponentInChildren<tk2dSpriteAnimator>();
        JumpDown = delegate(int height) {
            if (!grounded) return;
            velocity = new Vector2(velocity.x, jumpHeights[height]);
            anim.Play(a_jump);
            jumping = true;
            grounded = false;
        };

        JumpUp = delegate() {
            velocity = new Vector2(velocity.x, 0);
        };

        Gravity = delegate() {
            if (grounded) return;
            velocity += new Vector2(0, -movement.gravity);
        };

        OnLand += delegate() {
            velocity = new Vector2(velocity.x, 0);
            anim.Play(a_walk);
        };
    }
 void OnDisable()
 {
     OnFlyBegin -= SetTime;
 }
 void OnEnable()
 {
     OnFlyBegin += SetTime;
 }
    //[SerializeField][Header("Turn this off for sanity")]
    //private bool bDebugRotation = false;

    // Utility for performance
    // Only bind event once - as opposed to every frame
    // If return type wasn't void, could use llambda function instead - a => a.b
    public void AssignJumpEvent(JumpDelegate JumpDel)
    {
        // Assigned from Player script
        OnFlyBegin = JumpDel;
    }
Exemple #7
0
 /// <summary>
 /// Sets the jump delegate.
 /// </summary>
 /// <param name="theDelegate">The delegate.</param>
 public void SetJumpDelegate(JumpDelegate theDelegate)
 {
     m_JumpDelegate = theDelegate;
 }