Exemplo n.º 1
0
    private void onCollisionEnter(collCtx ctx)
    {
        if (this.targetPriority >= ctx.otherType ||
            (ctx.otherType == Type.Minion && this.follower != null))
        {
            return;
        }

        this.target         = ctx.other;
        this.otherT         = ctx.other.transform;
        this.targetPriority = ctx.otherType;

        if (ctx.otherType == Type.Minion)
        {
            this.issueEvent <Leader>(
                (x, y) => x.SetFollower(this), ctx.other);
        }
    }
Exemplo n.º 2
0
    private void onCollisionExit(collCtx ctx)
    {
        if (this.target == ctx.other)
        {
            Dir moveDir;

            if (this.targetPriority == Type.Minion)
            {
                this.issueEvent <Leader>(
                    (x, y) => x.RemoveFollower(this), ctx.other);
            }

            /* The target we were following just left, try to move after it */
            this.target         = null;
            this.targetPriority = Type.None;
            moveDir             = vec3ToDir(otherT.position - this.selfT.position);
            this.StartCoroutine(this.follow(ctx.other, moveDir));
        }
    }