コード例 #1
0
    // See if they have collided with something

    private void CheckCollision(Tux thing)
    {
        if (Vector3.Distance(thing.transform.position, this.transform.position) < 0.1)
        {
            thing.DamageCollision("NPC", 1f);
        }
    }
コード例 #2
0
    // Use this for initialization
    void Start()
    {
        modulo = 10;
        speed  = 1F;
        //     null == dir : dir = MOVEDIR.DOWN ? ;
        moveCooldown = 0;
        idle         = false; moving = false;
        moveDivisor  = 9;
        gameboard    = FindObjectOfType <Gameboard>();
        if (null == gameboard)
        {
            gameboard = ScriptableObject.CreateInstance <Gameboard>();
            gameboard.Start();
        }

        PC = GetComponent <Tux>();

        // gridPosition = new Vector3(9F, 3F, 0F);
        animator     = GetComponent <Animator>();
        flipAnimator = false;
        // animator.Play("tux-up");
    }