示例#1
0
    // Start is called before the first frame update
    void Start()
    {
        gameObject.layer = 9;
        AssignTarget("Cargo");

        thruster = GetComponent <Thruster>();
        thruster.SetThrustBase(8f);
        thruster.SetThrustV(1f);// Go forward

        weapon        = GetComponent <Weapon>();
        weapon.origin = 1;
        // Bit shift the index of the layer (8) to get a bit mask. This would be 0000000100000000, with 1 starting all the way on the right and moving 8 steps to the left.
        // This number is the same as 256. 1<<9 would be 512. 1<<10 would be 1024.
        // For multiple layers  (1<<8) | (1<<10);
        weapon.layerMask = 1 << 8;// Ignore all but 8
    }